【发布时间】:2019-12-20 11:07:18
【问题描述】:
我正在尝试进行第三方授权。当我向服务器发送 POST 请求时,它会发送 HTML 作为响应。
标题
private httpOptions = {
headers: new HttpHeaders({
'Accept': 'text/html',
'Content-Type': 'application/json'
}),
responseType: 'text',
};
API 调用
return this.http.post(this.authUrl, this.httpOptions)
.subscribe(data => {
console.log(data);
});
我收到一个语法错误:
JSON.parse 中位置 0 处的 JSON 中的意外标记
【问题讨论】:
-
您缺少 http 正文参数
标签: angular typescript