英文:
axios-curlirize npm not printing proxy in console log
问题
我在我的代码中使用了 axios 和 axios-curlirize npm 库。它对所有的 API 调用都有效。但是我的一个 API 使用了代理,在我访问该 API 时,axios-curlirize 包会在控制台中打印出 curl 请求,但它不会打印包括代理设置在内的完整的 curl 请求。
我想要获取包括代理设置在内的完整 curl 请求。
我正在使用这些库。当我访问我的 API 时,在控制台中看到以下内容:
import axios from 'axios';
import curlirize from 'axios-curlirize';
curlirize(axios);
curl -X GET "http://host:port/url" -H "Authorization:Basic token"
但我没有获取到包括代理设置在内的完整 curl 请求。
英文:
I am using axios and axios-curlirize npm libraries in my code. It is working for all API calls. But one of my API is using a proxy, when I hit that API axios-curlirize package prints curl request for it in console, but it doesn't print the complete curl request for that API including the proxy settings.
I want to get the complete curl request with proxy settings in it.
I am using these libraries. When I make a hit to my API, I get this in console.
import axios from 'axios';
import curlirize from 'axios-curlirize';
curlirize(axios);
curl -X GET "http://host:port/url" -H "Authorization:Basic token"
But I am not getting the complete curl request with proxy settings in it.
答案1
得分: 1
axios-curlirize 不支持代理。
您可以在命令行上使用 -x 参数来设置代理参数。
curl -x 'http://proxy_host:proxy_port' 'http://api_host:api_port/some-url' -H "Authorization: Basic some_token"
英文:
There is no support for proxy in axios-curlirize.
You can use -x arg on the command line for proxy parameters.
curl -x 'http://proxy_host:proxy_port' 'http://api_host:api_port/some-url' -H "Authorization:Basic some_token"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论