【发布时间】:2018-06-15 22:32:55
【问题描述】:
我正在尝试测试登录帖子,端点存在并且正常,但响应始终是错误的。 详细信息:请求未在我的端点中命中,因此错误 500 不是我的后端错误。 细节 2:在 chrome 的网络选项卡中,请求没有出现。
错误返回:
body:Object {error: "Object(...) is not a function"}
headers:HttpHeaders {normalizedNames: Map(0), lazyUpdate: null, lazyInit: }
status:500
statusText:"Internal Server Error"
url:"http://localhost:8080/"
我的代码是:
login(user, onsuccess?, onerror?): void {
let url: string = `${this.BASE_URL}/`;
this.httpClient.post(url, user, { headers: this.headers }).subscribe(
response => {
this.setLogin("test");
if (onsuccess) {
onsuccess(response);
}
},
error => {
this.setLogin("test");
if (onerror) {
onerror(error);
}
},
);
}
怎么了?
【问题讨论】:
标签: javascript angular typescript httprequest