更新时间:2022-12-04 08:42:55
您已将responseType: 'text'
放在httpOptions
的错误部分中-它应位于headers
的外部中,像这样:
You've put responseType: 'text'
in the wrong section of your httpOptions
- It should sit outside of headers
, like so:
private httpOptions = {
headers: new HttpHeaders({
'Accept': 'text/html, application/xhtml+xml, */*',
'Content-Type': 'application/x-www-form-urlencoded'
}),
responseType: 'text'
};
使用以前的方法,将responseType
的请求标头发送到服务器,而不是简单地向Angular发出指令以将响应实际视为文本.
With what you had before, a request header of responseType
was being sent to the server, rather than simply having an instruction to Angular to actually treat the response as text.