I am attempting to make an http.patch request to the server in my Nativescript application, which is built with Typescript and Angular2. The backend system is developed using Python(Django).
Here is the code for my request:
updateOrder(id, message) {
let headers = new Headers();
headers.append("Authorization", "Token " + Config.token);
headers.append("Content-Type", "application/json");
return this.http.patch(
Config.apiUrl + "orders/" + id + "/",
message,
{headers: headers}
)
.map(response => response.json())
.catch((res: Response) => this.handleErrors(res));
Next, I execute the request:
changeStatus(status){
var message = JSON.stringify({status: status});
this.orderService.updateOrder(this.order.id, message).subscribe(
data => console.log(data),
err => alert(JSON.stringify(err))
);
}
However, the server responds with the following data:
{"_body":{},"status":200,"ok":true,"statusText":"","headers":{},"type":3,"url":null}
Despite this response, the "status" property that I intended to change remains unchanged.
What could be causing this issue?