axios在重定向时返回406错误码
创始人
2024-09-29 05:00:32
0

可以尝试在请求中添加“followRedirects:true”选项,代码示例如下:

axios.get(url, { followRedirects: true }) .then(response => { console.log(response); }) .catch(error => { console.log(error); });

另外,如果请求的url是https协议,需要添加“httpsAgent”选项并设置“rejectUnauthorized”为false,代码示例如下:

const https = require('https'); const agent = new https.Agent({ rejectUnauthorized: false });

axios.get(url, { httpsAgent: agent, followRedirects: true }) .then(response => { console.log(response); }) .catch(error => { console.log(error); });

通过以上方法,可以解决axios在重定向时返回406错误码的问题。

相关内容

热门资讯

透视app(wepOke)来玩... 透视app(wepOke)来玩app有挂吗(透视)详细辅助2025新版技巧1、许多玩家不知道来玩ap...
透视好友房!wpk辅助ai(透... 透视好友房!wpk辅助ai(透视)详细辅助黑科技教程(竟然真的有挂);1、不需要AI权限,帮助你快速...
透视游戏!hhpoker真的假... 透视游戏!hhpoker真的假的(透视)一贯存在有挂(详细辅助攻略教程)是一款可以让一直输的玩家,快...
透视透视挂(wePOke)im... 透视透视挂(wePOke)impoker有挂吗(透视)详细辅助2025新版1、不需要AI权限,帮助你...
透视软件!红龙poker辅助(... 透视软件!红龙poker辅助(透视)详细辅助软件教程(总是是有挂)红龙poker辅助辅助器中分为三种...
透视实锤!wepoker俱乐部... 透视实锤!wepoker俱乐部辅助(透视)素来是有挂(详细辅助新2025版);1.wepoker俱乐...
透视数据(wePoKe)aap... 1、透视数据(wePoKe)aapoker辅助软件(透视)详细辅助黑科技教程。2、aapoker辅助...
透视软件!德朴之星脚本(透视)... 透视软件!德朴之星脚本(透视)详细辅助靠谱教程(一直有挂)1、每一步都需要思考,不同水平的挑战会更加...
透视游戏!pokemmo脚本辅... 透视游戏!pokemmo脚本辅助下载(透视)其实真的是有挂(详细辅助wpk教程);支持2-10人实时...
透视了解(wePoke)wep... 《透视了解(wePoke)wepower系统规律(透视)详细辅助德州教程》 wepower系统规律软...