尝试使用post方法抛出数据时遇到问题,但是得到的却是一个很奇怪的响应。如下:The Response
这是我的代码:
sendPostRequest() {
var headers = new Headers();
headers.append("Accept", 'application/json');
headers.append('Content-Type', 'application/json' );
const requestOptions = new RequestOptions({ headers: headers });
let postData = JSON.stringify({
grant_type:"test1",
client_id:"test2",
client_secret:"test3"
});
this.http.post("http://localhost:8080/suitecrmxperuri/api/oauth/access_token", postData, requestOptions)
.subscribe(data => {
alert("Ini Sukses "+data['_body']);
console.log(data['_body']);
}, error => {
console.log(error);
alert("Ini Gagal "+error);
});
}