[英]Why Angular HTTP sends no body in POST request?
这是向服务器发送请求的方法:
public Get(body: IGetPassportInfoRequest): Observable<IGetPassportInfoResponse> {
let httpHeaders = new HttpHeaders({
'Content-Type' : 'application/json',
'Cache-Control': 'no-cache'
});
let options = {
headers: httpHeaders
};
return this.http.post('http://ip:9090/terminal/get', body, options)
.catch(this.handleError);
}
身体是物体的地方:
const data: IGetPassportInfoRequest = {
doc_serie: this.step1.controls['passport_seria'].value,
doc_number: this.step1.controls['passport_number'].value
};
在 chrome 网络中,我看到:
你在这里得到的是一个与 CORS 相关的错误。 您尝试向其发送数据的服务器需要:
阅读更多: CORS
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.