【发布时间】:2020-05-12 06:49:42
【问题描述】:
我正在尝试将 JSON 数据从 Angular 9 发布到 webapi。
这是我的 POST 代码
const headers=new HttpHeaders().set("Content-Type",'application/json');
let url:string=this.isServer?"":"https://localhost:44331/api";
console.info(JSON.stringify(data));
return this.client.post<any>(url+'/Crrequests',JSON.stringify(data),
{headers,responseType:"json",withCredentials:true});
当我执行它时会触发一个错误提示
“出现一个或多个验证错误”
在开发者控制台中。
但我用 POSTMAN 检查了同一组 JSON。它工作正常。
所以没有想法有什么问题。
【问题讨论】:
标签: angular asp.net-core http-post