body4不会在angular4 post方法的头请求中发送

时间:2017-09-20 14:54:47

标签: angular angular2-forms

我是angular2的新手。我试图通过post方法命中服务器api。请求中缺少正文。所以我无法在帖子中获取数据以下是我的代码: -

data = JSON.stringify({test:'check'});
  let headers = new Headers();
  headers.append('Content-Type', 'application/json');
  console.log(headers);
return this.http.post(url, data, {
  headers: headers
});

当我检查其卷曲网址请求时,它正在关注

curl 'http://dev.dynamicreports.xyz.com/designer/save/chart-config?userId=2&reportId=1' -H 'Origin: http://dev.dynamicreports.xyz.com' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-GB,en-US;q=0.8,en;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36' -H 'Content-Type: application/json' -H 'Accept: application/json, text/plain, */*' -H 'Referer: http://dev.dynamicreports.xyz.com/ui-charts-designer/build/prod/' -H 'Cookie: __utma=70597123.1022822661.1496666160.1496666160.1503145923.2; __utmz=70597123.1496666160.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); _ga=GA1.2.1022822661.1496666160; PHPSESSID=8sq761b6op301nmvs3ds8qv501; __auc=df1847cd15c78414fc7a8e0b4e0' -H 'Connection: keep-alive' --data-binary '{"test":"check"}' --compressed

我花了大约4个小时。任何有关这方面的帮助都是值得的。提前谢谢。

0 个答案:

没有答案