-
Notifications
You must be signed in to change notification settings - Fork 111
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
Add support for proxy servers... #27
Comments
Hmm, does this need adding to I think this may have changed from a feature request, into a question. Would this work...? var chai = require("chai")
, chaiHttp = require('chai-http')
, proxy = 'http://proxy.example.org:80';
chai.use(chaiHttp);
require('superagent-proxy')(chai);
chai
.request('http://external.example.com')
.get('/')
.proxy(proxy)
.end(function (res) {
}); |
Hey again @nfreear 😄. superagent-proxy needs access to the SuperAgent instance, which for chai-http is in var chai = require("chai")
, chaiHttp = require('chai-http')
, proxy = 'http://proxy.example.org:80';
chai.use(chaiHttp);
require('superagent-proxy')(chai.request.Test);
chai
.request('http://external.example.com')
.get('/')
.proxy(proxy)
.end(function (res) {
}); Let me know if this works for you and I'll close out the issue 😄 |
* Trying to use "superagent-proxy" - fails so far * https://github.com/TooTallNate/superagent-proxy * chaijs/chai-http#27
Hi, I haven't succeeded in getting it working so far. Fails with:
Note, you may need this workaround if Bit of a puzzle. Yours, nick |
@nfreear ok. This looks to be because we call our SuperAgent instance "Test" while this plugin is expecting "Request". Should be a simple enough change - simply add a line between 173-174 of request.js saying module.exports.Request = Test; And then your first example of |
Bug #27, Add support for proxy servers via "superagent-proxy"
* Switch to a GitHub link for "chai-http" dependency - package.json * --> Access the edge/pre-release version, not yet in http://npmjs.com * chaijs/chai-http#27 * `page()` becomes a new function definition, wrapping a call to `proxy()`
For those who see this and don't want to change the module. I got it to work this way (for v1.0): var chai = require("chai");
var chaiHttp = require("chai-http");
chai.use(chaiHttp);
chai.request.Request = chai.request.Test;
require('superagent-proxy')(chai.request); |
(Not reverse-proxy)
Hi,
I think we'd need to integrate superagent-proxy - how to make this optional?
Ideas?
Thanks,
Nick
The text was updated successfully, but these errors were encountered: