question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How can I pass my own http.agent in a request

See original GitHub issue

I need to pass my own proxy agent in a request. Meaning, all the requests inside my application should use my customized agent which makes the requests pass through a proxy. Something similar to agent object in http.request. Is there a easy way to do it?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
kornelskicommented, Dec 11, 2016

I think we could add more cross-request customizability via superagent.agent() methods. That creates an instance that an app could safely change.

I’d rather not have any global superagent.on, because then libraries couldn’t safely use superagent without risking interfering with each other.

0reactions
pszabopcommented, Nov 3, 2017

agreed, I want to put the cookies into (result of superagent.agent() and then put those cookies into the headers Authorization or X-CSRF on all outbound HTTP requests.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I pass my own http.agent in a request #1130 - GitHub
Passing the agent (result of superagent.agent() ) around is the right solution. It's like dependency injection. If you expect to modify behavior ...
Read more >
Request: Specifying custom agent that can handle http & https
If you use agentOptions instead of passing an http(s).Agent instance, request will create an agent for you for each scheme that is used:...
Read more >
User-Agent - HTTP - MDN Web Docs - Mozilla
The User-Agent request header is a characteristic string that lets servers and network peers identify the application, operating system, ...
Read more >
Please explain how to use the new http.Agent - Google Groups
I'm trying to make hundreds of requests to different hosts and I don't know which is the best approach to handle a request...
Read more >
Set a custom user agent | New Relic Documentation
To set a custom user agent, include an agent string in the HTTP header User-Agent. ... For the integration name, use a string...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found