Comments (7)
How about using node_httpAgent
and note_httpsAgent
properties to set the Agents? You can set them on an instance-by-instance basis, or you can change them in XMLHttpRequest.prototype
Would this work?
from node-xhr2.
This is what I had in mind: In my locally modified xhr2, this is what I am doing, with the following change:
- I have created an external interface construct(options.agents) and setAgents() to avoid fiddling directly with internal prototypes & variables
- I have renamed @node_httpAgent into @httpAgent (and same for httpsAgent), because it was more consistent with other class members.
If you are Ok with this, then I'll move forward & propose a patch (likely tomorrow in my timezone)
from node-xhr2.
Just uploaded #2
from node-xhr2.
Thank you for #2, I merged it!
How would you feel about a XMLHttpRequest.nodejsSetAgents()
method that would set the prototype properties?
This way, you can use the following in your code that uses dropbox.js
Dropbox.Xhr.Request.nodejsSetAgents(....)
The nice thing about this approach is that if dropbox.js ever switches to another XHR library, proxy-setting code will fail right away during development, instead of silently ignoring the agent-related properties.
from node-xhr2.
In my local copy of Dropbox-js, I rather added a dependency on node-tunnel & gave additional Client instanciation parameter then passed down to xhr2. But I admit that I could rather leaver Dropbox-js un-modified & use the shortcut you propose. (1) Less code is always better than the opposite and (2) that lets dropbox-js of an additional dependency.
I think that the additional interface you propose is fine, but I would rather let you implent it, if you do not mind.
from node-xhr2.
Sweet, I'll get that in soon, and I will release 0.0.4 once I get some tests for events in.
from node-xhr2.
I hope this works now!
from node-xhr2.
Related Issues (20)
- Angular 2 support HOT 8
- Synchronous XHR processing not implemented HOT 6
- Support for responseURL HOT 1
- Add Blob support HOT 2
- Backup plan for coffeedocs? HOT 1
- Process hangs if request follows a redirection
- Non-automatic redirects HOT 1
- Support for withCredentials attribute in request object HOT 1
- Support for custom User-Agent HOT 3
- Support synchronous function HOT 3
- Turn off keepalive or re-use existing connections. HOT 2
- [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead HOT 3
- Deprecated url.parse() is used - results in malformed request
- Resolve location url according to RFC #7230
- URGENT! Cannot do any request
- Typings for use with Typescript? HOT 5
- nodejs: The url module has expired and the URL class is recommended
- window is not defined
- `Discarding entity body for GET requests` logging is surfacing through all my XHR requests
- Unsupported send() data function Writer() HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-xhr2.