遇到这么个情况,请大神指教 这个接口 https://api.testnet.huobi.pro/v1/common/symbols 在浏览器上可以正常访问返回数据:
但是使用 axios 请求却会报错:
报错信息:
C:\Users\Maxzel\Desktop\huobi>node app.js
(node:7804) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT 174.37.154.236:80
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
(node:7804) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:7804) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
之后尝试改 headers,将 axios 换成 request,superagent 来请求都无法得到返回数据,但为什么浏览器又可以直接返回呢?应该怎么解决?
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.