axiosリクエストUncaught(in promise)Error:Request failed with status code 404

713 ワード

axiosを使用してリクエストを処理する場合の問題解決
urlがリモートインタフェースリンクである場合、404のエラーが報告される.
Uncaught (in promise) Error: Request failed with status code 404 

解決方法:
var instance = axios.create({ headers: {'content-type': 'application/x-www-form-urlencoded'} });
instance.post(`url`, params).then(res => res.data); 

バックグラウンドでは、転送パラメータの解決方法が受信されません.
var qs=require('qs'); 
var instance = axios.create({ headers: {'content-type': 'application/x-www-form-urlencoded'} });
instance.post(`url`, qs.stringify(params)).then(res => res.data); 

 
  
転載先:https://www.cnblogs.com/nicest/p/9599089.html