aboutsummaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-proxy.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/node-gyp/node_modules/request/tests/test-proxy.js')
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/request/tests/test-proxy.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-proxy.js b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-proxy.js
new file mode 100644
index 0000000000..647157cae6
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/node_modules/request/tests/test-proxy.js
@@ -0,0 +1,39 @@
+var server = require('./server')
+ , events = require('events')
+ , stream = require('stream')
+ , assert = require('assert')
+ , fs = require('fs')
+ , request = require('../main.js')
+ , path = require('path')
+ , util = require('util')
+ ;
+
+var port = 6768
+ , called = false
+ , proxiedHost = 'google.com'
+ ;
+
+var s = server.createServer(port)
+s.listen(port, function () {
+ s.on('http://google.com/', function (req, res) {
+ called = true
+ assert.equal(req.headers.host, proxiedHost)
+ res.writeHeader(200)
+ res.end()
+ })
+ request ({
+ url: 'http://'+proxiedHost,
+ proxy: 'http://localhost:'+port
+ /*
+ //should behave as if these arguments where passed:
+ url: 'http://localhost:'+port,
+ headers: {host: proxiedHost}
+ //*/
+ }, function (err, res, body) {
+ s.close()
+ })
+})
+
+process.on('exit', function () {
+ assert.ok(called, 'the request must be made to the proxy server')
+})