【发布时间】:2018-01-11 18:39:00
【问题描述】:
我正在使用 Loopback 后端 REST API 和 Angular 5 前端。但是,我无法让 post 函数工作 - 我一直收到错误“值不是对象”。
this.http.post(url, {
"displayName": user.displayName,
"email": user.email,
"uid": user.uid,
"photoURL": user.photoURL,
"phoneNumber": user.phoneNumber,
"verifiedPhone": user.verifiedPhone
}, {params: new HttpParams().set('where','uid=' + user.uid)}).subscribe( res => {
console.log("results of updating user: ", res);
});
【问题讨论】:
-
你用的是旧的Http服务,还是新的HttpClient服务?
-
我正在使用新的 HttpClient 服务。
-
错误在哪一行,或者错误发生在服务器上?
-
可能是 'uid=' 等号。奇怪的是,在 post 请求上有一个查询参数。
-
我尝试使用 %3D 而不是 =,但出现 500 服务器错误。错误在服务器的响应中。