对于此发布请求,我无法获得任何服务器响应:
WHERE
更新:
Fiddler显示了我希望获得的服务器响应
this.httpClient
.post(this.appConfigService.buildAuthorizationUrl('/logon'), data, {
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
//observe: 'response',
})
.toPromise()
.then(
(response: any) => {
// not reached
},
(error: any) => {
// not reached
}
)
.catch(ex => {
// not reached
});
成功阻止:
一个服务器响应示例:
.then
更新 可能是因为标头
HTTP/1.1 400 Bad Request
Cache-Control: no-cache,no-cache, no-store, must-revalidate
Pragma: no-cache,no-cache
Content-Type: application/json;charset=UTF-8
Expires: -1,0
Server: Microsoft-IIS/10.0
X-SourceFiles: =?UTF-8?B?QzpcVXNlcnNcS2F5IFphbmRlclxEb2N1bWVudHNcZXZlXFNvdXJjZVxJbmZvcnNIVC5HZW5lc2lzQXBpXGxvZ29u?=
X-Powered-By: ASP.NET
X-UA-Compatible: IE=edge
Date: Wed, 30 Oct 2019 10:33:16 GMT
Content-Length: 79
{"error":"Error","error_description":"The user name or password is incorrect."}
代替
Sec-Fetch-Site: same-site
Sec-Fetch-Mode: cors
背景: 我正在将现有的angularjs应用程序迁移到angular,并使用相同的(未更改)API
答案 0 :(得分:0)
问题是由CORS问题引起的