【发布时间】:2019-12-04 14:26:38
【问题描述】:
我正在 Angular 8 中测试一个简单的登录 API 调用。当我使用正确的凭据时,帖子可以正常工作并且我已登录。
当我使用无效凭据测试调用时,我在 Angular 中没有看到正确的错误响应。
当我使用我得到的无效凭据在 Postman 中测试调用时:
{ "error": { "title": "Error", "status": 422, "message": "Those details are incorrect", "code": "VALIDATION_ERROR" } }
当我使用无效的凭据在 Angular 中进行调用时,我得到以下信息:
Error Response: {
"headers": {
"normalizedNames": {},
"lazyUpdate": null,
"headers": {}
},
"status": 422,
"statusText": "OK",
"url": "https://myServerName/login",
"ok": false,
"name": "HttpErrorResponse",
"message": "Http failure response for https://myServerName/login: 422 OK",
"error": null
}
任何想法为什么会发生这种情况?
【问题讨论】:
标签: angular http postman http-status-code-422