我正在尝试进行第三方授权。当我向服务器发出 POST 请求时,它会发送 HTML 作为响应。
标头
private httpOptions = {
headers: new HttpHeaders({
'Accept': 'text/html',
'Content-Type': 'application/json'
}),
responseType: 'text',
};
Run Code Online (Sandbox Code Playgroud)
API调用
return this.http.post(this.authUrl, this.httpOptions)
.subscribe(data => {
console.log(data);
});
Run Code Online (Sandbox Code Playgroud)
我收到一个语法错误:
JSON.parse 位置 0 处的 JSON 中出现意外标记 <