Reputation: 623
The following code works:
this.http.post (TGT_IP,body, {responseType: 'arraybuffer'}).subscribe(
(val) => {
console.log("POST call successful value returned in body",
val);
},
response => {
console.log("POST call in error", response);
},
() => {
console.log("The POST observable is now completed.");
});
Then I tried the following code:
var body = [0x11,0x22,0x33,0x44];
this.http.post (TGT_IP,
body,
{ headers: new HttpHeaders({'Content-Type': 'octet/stream',
'Accept': 'octet/stream'}),
responseType: 'arraybuffer'
}).subscribe(
(val) => {
console.log("POST call successful value returned in body",
val);
},
response => {
console.log("POST call in error", response);
},
() => {
console.log("The POST observable is now completed.");
});
Can you please tell why in this code body is not sent at all ?
Thank you, Zvika
Upvotes: 0
Views: 46
Reputation: 2715
The code in the question seems to be correct. The Angular http post can be tested here. The request of the example can be investigated here.
Based on the above example there should be an issue with the API, which is handeling the POST request.
Upvotes: 1