1 var server
= require('./server')
2 , events
= require('events')
3 , stream
= require('stream')
4 , assert
= require('assert')
6 , request
= require('../main.js')
7 , path
= require('path')
8 , util
= require('util')
13 , proxiedHost
= 'google.com'
16 var s
= server
.createServer(port
)
17 s
.listen(port
, function () {
18 s
.on('http://google.com/', function (req
, res
) {
20 assert
.equal(req
.headers
.host
, proxiedHost
)
25 url
: 'http://'+proxiedHost
,
26 proxy
: 'http://localhost:'+port
28 //should behave as if these arguments where passed:
29 url: 'http://localhost:'+port,
30 headers: {host: proxiedHost}
32 }, function (err
, res
, body
) {
37 process
.on('exit', function () {
38 assert
.ok(called
, 'the request must be made to the proxy server')