[英]Catch return json from POST with Axios when error 400 (Bad Request) occurs
在您的catch
塊中, error
對象還為您提供了一個響應正文
//... your request here
.catch(error => {
console.log('response: ', error.response.data);
});
console.log(error)
正在調用錯誤對象的toString
方法,該方法不會向您顯示響應正文。
error.response.data
應該給你正確的內容。 看看axios 文檔的這一部分
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.