axios get 请求报错?

 axios
          .get(data.clientClickUrl)
          .then((res) => {
            console.log('clientClickUrl 上报成功');
          })
          .catch((res) => {
            console.log(res, 'clientClickUrl 失败');
          })

报错
image.png

image.png

请求地址
https://ccc-x.jd.com/dsp/nc?e...

请求地址会自动跳转

阅读 2.1k
3 个回答

因为这个链接请求到的是如下图
image.png

是下面这个链接吧,我这边用Postman get请求返回的HTML文本

https://ccc-x.jd.com/dsp/nc?ext=aHR0cDovL2l0ZW0ubS5qZC5jb20vcHJvZHVjdC8xMDAzMzc1MzUyNDAwMi5odG1s&log=wel512hijPTaZ4PNqBEiUfsKyF5QyCN0Vv0esSPAl8KUE3FMBp6OZm2UksS8vqQtXt7bDIvc9NDP7aMteOPxIZ2KP9SaX3jvalgeUWyIM5N5lBG3TakDmR97Indtc2zLuuSJcmGQZQNIi_Zumo8RTuyt7XbDBrlEN3yylcEFEbuwa2EepwUcba3SJ1Y9Rlm-SaIU2qTCHR8PmfiKHf6yT9pSmxI3WXGArr4gAKUc2PYqY3qnwHm8mrRlQwqzpKVOZOnz5x4xpe4gohysi6-o8xQECrpr6Yvioe376H8HGJi4b3Hmdrmm-ENlniCY7E1PoyhEWmdhZ5-LQ9vPgSTwqBRjOtFNRCr538vpV7nY4XRE0lh7H6gDKz3cDrEdy9VV9sBGpgF69rmlR8f7GKyZsugO1meXGoWVFUNrxV0h_H1BpcleQIwdJig7s3ZoVnBo7YfaCCZClLzSC-AnTqYJib6IlGPHTIMAFG4zj9chFaHNKFPXpxK7d1nrPJ8RqARpXcvmLeg0HUVArgKCk-RKYfbDdNzYwZegC3oCboYx8-ug1uYomIA2iqAPtqL8CtigT_IGps5X-VfFdrEPaHT4tZURG4Fyk_sFRV7afUdArjMhIPpsQUjMrHIlJ_-zK9uaH9Lf-K3NtWd27MlFAyZEi__VsI1R-vUt0VrdbCCywP-wmQwDxbXOsjwPlD0ja6zok-AgKTRmfBwA--kSoNDwZsycP9ucylgA29qcJMfjmV1QL5rQJDTjZMMIkMId_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jQmnWz--OBqe71XL6lFH0NXHKZyMcxLZql-eLdwVv8OrLW9PGFZW58hLlbogr2C_Z4trp04QuS7TA75-UcaClvmgZHyi9yPQ0L7AySWHkVMHeUYLE3PK2XnxyAKY1oRE8P-kgq2-PH7hBcEmLm_8Bj4c4Oo9Czl3JLTkg&v=404&ssp_test=1

image.png

上面是我直接通过Postman请求的,返回正常。
你可以看看是不是请求头 或者 请求配置有点问题

不懂你的目的是什么,这是个重定向请求的话就是会跳到另一个页面,你是想拿到这个请求的返回值?重定向请求也没有返回值吧,就是直接跳走了,你的截图也不是报错吧,就是返回了302的重定向状态码。
感觉可以就写个a标签直接把这个请求地址设置到href上,或者用window.open打开这个地址

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进