axios-curlirize npm未在控制台日志中打印代理。

huangapple go评论65阅读模式
英文:

axios-curlirize npm not printing proxy in console log

问题

我在我的代码中使用了 axiosaxios-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"

huangapple
  • 本文由 发表于 2023年6月19日 20:44:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/76506757.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定