Sha256: bbae69baee26e0c554855ab9b4dff6f7b35c1604319453ff4b666297d3e158c5

Contents?: true

Size: 920 Bytes

Versions: 13

Compression:

Stored size: 920 Bytes

Contents

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')
})

Version data entries

13 entries across 7 versions & 2 rubygems

Version Path
vulcan-0.8.2 server/node_modules/cradle/node_modules/request/tests/test-proxy.js
vulcan-0.8.2 server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-proxy.js
vulcan-0.8.1 server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-proxy.js
vulcan-0.8.1 server/node_modules/cradle/node_modules/request/tests/test-proxy.js
iron_worker_ng-0.10.1 iron_worker_examples/binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/test-proxy.js
vulcan-0.8.0 server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-proxy.js
vulcan-0.8.0 server/node_modules/cradle/node_modules/request/tests/test-proxy.js
vulcan-0.7.2 server/node_modules/cradle/node_modules/request/tests/test-proxy.js
vulcan-0.7.2 server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-proxy.js
vulcan-0.7.1 server/node_modules/cradle/node_modules/request/tests/test-proxy.js
vulcan-0.7.1 server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-proxy.js
vulcan-0.7.0 server/node_modules/cradle/node_modules/request/tests/test-proxy.js
vulcan-0.7.0 server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-proxy.js