使用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);

 

  

axios请求报Uncaught (in promise) Error: Request failed with status code 404的更多相关文章

  1. Uncaught (in promise) Error: Request failed with status code 500解决方案

    今天又学到一种修改bug的方法  : let newpwd = crypto.createHash('md5').update(req.body.upwd).digest('hex'); 在点击按钮加 ...

  2. Request failed with status code 500以及自引用循环Self referencing loop detected for property ‘xx‘ with type

    错误Error: Request failed with status code 500 ,调试前端没问题,后端也没问题,还报错"连接超时" 在Network中找到错误Self r ...

  3. Qt error ------ 出现Error - RtlWerpReportException failed with status code :-1073741823. Will try to launch the process directly

    出现原因: 使用了不存在的对象 数组越界了 用 delete 释放未分配的内存空间,或者超过一次释放同个内存 比如: 顺序不能颠倒 正确: ui->setupUi(this); ui->t ...

  4. 解决"Uncaught (in promise) Error: Navigation cancelled from "/" to "/login" with a new navigation"报错处理

    Uncaught (in promise) Error: Navigation cancelled from "/" to "/login" with a ne ...

  5. Ionic3报错Error: Uncaught (in promise): Error: StaticInjectorError

    ERROR Error: Uncaught (in promise): Error: StaticInjectorError[Geolocation]: StaticInjectorError[Geo ...

  6. Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first.

    最近在开发一个网站时,有个需要是 如果有新预警信息要在网页中播放提示音.页面打开会请求是否有新信息,有则播放提示音.在Chrome的最新浏览器中,播放会报错,控制台显示Uncaught (in pro ...

  7. 音频播放时出现 Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD

    <audio id="play" controls="controls" loop="loop"> <source src ...

  8. Error: MDM failed command. Status: Only a single SDC may be mapped to this volume at a time

    映射一个volume到多个SDC的时候报错如下: Error: MDM failed command.  Status: Only a single SDC may be mapped to this ...

  9. Oracle Error - "OCIEnvCreate failed with return code -1 but error message text was not available".

    ISSUE: When trying to connect to an Oracle database you receive the following error: "OCIEnvCre ...

随机推荐

  1. 201621123012 《Java程序设计》第7周学习总结

    1. 本周学习总结 1.1 思维导图:Java图形界面总结 答: 1.2 可选:使用常规方法总结其他上课内容. 2.书面作业 1. GUI中的事件处理 1.1 写出事件处理模型中最重要的几个关键词. ...

  2. 码云&Github 个人代码资源快速查找

    1.Siri SiriShortCut

  3. 如何设置linux支持上传的文件中文不乱吗

    一.背景: 1.由于客户的需求,需要a链接打开的pdf文件,支持中文名称的 二.步骤 ①.查看当前编码 locale ②.编辑 vi  /etc/profile 打开后结尾处添加  export LA ...

  4. 上课总结-模电chapter 2

    1.无明显失真时电压放大倍数——输出与输入电压的变化量之比 .无明显失真时 电流放大倍数——输出与输入电流的变化量之比 3.最大输出幅度 ①无明显失真时最大输出电压(或最大输出电流) ②交流有效值(U ...

  5. slowhttptest安装及使用

    slowhttptest简介: Slowhttptest是依赖HTTP协议的慢速攻击DoS攻击工具,设计的基本原理是服务器在请求完全接收后才会进行处理,如果客户端的发送速度缓慢或者发送不完整,服务端为 ...

  6. C# winform调用类似按钮点击的事件时自带参数该怎么写

    //按钮事件 private void btn_Click(object sender, EventArgs e) {} //自己的函数 private void myFunc() { //程序中其他 ...

  7. HDU6342-2018ACM暑假多校联合训练4-1011-Problem K. Expression in Memories

    Problem K. Expression in Memories Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262 ...

  8. 我的csdn博客地址

    呆雁 持续的谦虚与努力 http://blog.csdn.net/u013539183

  9. eclipse创建Java项目时提示Open Associated Perspective?

    在eclipse中,原先使用python进行编程,需要新建java项目时,会提示如下信息: 消息框内翻译如下: Open Associated Perspective? --开放关联视角? This ...

  10. [HAOI2006]聪明的猴子 BZOJ 2429 Kruskal

    #include<iostream> #include<cstdio> #include<algorithm> #include<cstdlib> #i ...