以邮递员发送数据时,我的状态为200-成功[
但是当我尝试通过Angular CLI将POST请求发送到相同的URL时,出现了400错误,提示MALFORMED_JSON
const testData = {
"address_1": "ddd",
"contact_person_1": "ddd",
"full_name": "dsad",
"is_active": 2,
"phone_no_1": "11111",
}
return this.http.post(`${this.urlAdmin}branches/save`, testData).pipe(
catchError((err) => {
console.log('err' , err)
return of(false);
})
);
有人可以帮忙吗?
答案 0 :(得分:0)
从Angular调用api时,可以遵循以下顺序: this.http.post(baseUrl,parameterModel,headers).pipe();
,正如我所见,您需要添加标题,模型,并确保从api路径进入。