我这样做:
let headers = new Headers({
'Content-Type': 'application/json',
'Content-Encoding': 'deflate'
});
let options = new RequestOptions({ headers: headers });
let body = JSON.stringify({
"password": password,
"username": username
});
return this.http.post('URL HERE', body, headers).map((res: Response) => res.text());
但它返回的内容如下:
��V���0���C�`Y�F��Z��J��2�%n�l�f[��k�- I�f�M}�F̘y3o<�������J��-SYV�]�#i�,[���T���3�?�/fv��V$��ʈl�Ŀ��2?<�'B5� V��`��&kA !�FC�VJ�㍻�,/�+�fKw�S���%�Ѓ|�QJ>}�9�7fz���9zL�M�Gt�!�#?:�6��?�fH�k̄���Q(����z�7��U�r2�7��g2�[�
当我接受邮递员的电话时,没有问题。
任何提示?
答案 0 :(得分:1)
this.http.post(&#39; URL HERE&#39 ;, body,headers)应该是this.http.post(&#39; URL HERE&#39;,body,options)