Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want HTTP request go through a HTTP proxy in the nodejs #3679

Open
songtanjichuan opened this issue Oct 8, 2024 · 1 comment
Open

I want HTTP request go through a HTTP proxy in the nodejs #3679

songtanjichuan opened this issue Oct 8, 2024 · 1 comment

Comments

@songtanjichuan
Copy link

e:
const SwaggerClient = require('swagger-client');
const HttpsProxyAgent = require('https-proxy-agent');

const proxyUrl = 'http://your-proxy-url:port';
const agent = new HttpsProxyAgent(proxyUrl);

const request = {
url: 'https://httpbin.org/',
method: 'GET',
requestInterceptor: req => {
req.agent = agent; // 设置代理
return req;
},
};
The above example is incorrect. I am new in this area,Thanks for your help.

@songtanjichuan
Copy link
Author

I solved it
Add parameters userFetch to requestInterceptor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant