发布请求有效,但未返回响应(代码 200)。
`axios
.post(url, JSON.stringify(data))
.then((resp) => {
console.log("resp: ", resp.data.body);
console.log("result: ", resp.data.result);
alert(Success ${JSON.stringify(resp.data.result)});
})
.catch((err) => {console.error("Problem with Add: ", err); }); };`
在邮递员中运行相同的请求时,我收到带有自定义错误的响应:
`{
"statusCode": 200,
"headers": {
"Content-Type": "application/json",
"Access-Control-Allow-Headers": "",
"Access-Control-Allow-Origin": "",
"Access-Control-Allow-Methods": "*",
"Access-Control-Allow-Credentials": true
},
"body": ""成功"", “结果”: [ { "@full_error": "ERROR 1062 (23000): 键 'PRIMARY' 的重复条目 '501151'" }]}`
请指教