下面的代码可以用。
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.");
});
然后我又试了下面的代码
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.");
});
你能告诉我为什么在这段代码中,body没有被发送?
谢谢你,Zvika