From bb0d28c58729e2cc70e8446f7fbf1113a6fa9310 Mon Sep 17 00:00:00 2001
From: indexzero
Date: Thu, 26 Sep 2013 03:37:08 -0400
Subject: [PATCH] [refactor minor] s/caronte/http-proxy/ or
s/caronte/httpProxy/ where appropriate.
---
README.md | 24 +++++------
examples/error-handling.js | 8 ++--
examples/https-secure.js | 4 +-
examples/https.js | 4 +-
examples/stand-alone.js | 4 +-
index.js | 2 +-
lib/{caronte.js => http-proxy.js} | 20 +++++-----
lib/{caronte => http-proxy}/common.js | 0
lib/{caronte => http-proxy}/index.js | 16 ++++----
.../passes/web-incoming.js | 4 +-
.../passes/web-outgoing.js | 0
.../passes/ws-incoming.js | 2 +-
package.json | 14 ++++---
test/lib-caronte-common-test.js | 4 +-
test/lib-caronte-passes-web-incoming-test.js | 10 ++---
test/lib-caronte-passes-web-outgoing-test.js | 18 ++++-----
test/lib-caronte-passes-ws-incoming-test.js | 20 +++++-----
test/lib-caronte-test.js | 40 +++++++++----------
18 files changed, 99 insertions(+), 95 deletions(-)
rename lib/{caronte.js => http-proxy.js} (79%)
rename lib/{caronte => http-proxy}/common.js (100%)
rename lib/{caronte => http-proxy}/index.js (83%)
rename lib/{caronte => http-proxy}/passes/web-incoming.js (97%)
rename lib/{caronte => http-proxy}/passes/web-outgoing.js (100%)
rename lib/{caronte => http-proxy}/passes/ws-incoming.js (98%)
diff --git a/README.md b/README.md
index bc64e4226..c44fcd6d7 100644
--- a/README.md
+++ b/README.md
@@ -2,10 +2,10 @@
-Caronte
+node-http-proxy
=======
-Caronte is an HTTP programmable proxying library that supports
+`node-http-proxy` is an HTTP programmable proxying library that supports
websockets. It is suitable for implementing components such as
proxies and load balancers.
@@ -21,12 +21,12 @@ proxies and load balancers.
### Core Concept
A new proxy is created by calling `createProxyServer` and passing
-an `options` object as argument ([valid properties are available here](tree/master/lib/caronte.js#L26-L39))
+an `options` object as argument ([valid properties are available here](tree/master/lib/http-proxy.js#L26-L39))
```javascript
-var caronte = require('caronte');
+var httpProxy = require('http-proxy');
-var proxy = caronte.createProxyServer(options);
+var proxy = httpProxy.createProxyServer(options);
```
An object will be returned with four values:
@@ -44,7 +44,7 @@ require('http').createServer(function(req, res) {
});
```
-When a request is proxied it follows two different pipelines ([available here](tree/master/lib/caronte/passes))
+When a request is proxied it follows two different pipelines ([available here](tree/master/lib/http-proxy/passes))
which apply transformations to both the `req` and `res` object.
The first pipeline (ingoing) is responsible for the creation and manipulation of the stream that connects your client to the target.
The second pipeline (outgoing) is responsible for the creation and manipulation of the stream that, from your target, returns data
@@ -58,11 +58,11 @@ In addition, every stage emits a corresponding event so introspection during the
```js
var http = require('http'),
- caronte = require('caronte');
+ httpProxy = require('http-proxy');
//
// Create your proxy server
//
-caronte.createProxyServer({target:'http://localhost:9000'}).listen(8000);
+httpProxy.createProxyServer({target:'http://localhost:9000'}).listen(8000);
//
// Create your target server
@@ -78,12 +78,12 @@ http.createServer(function (req, res) {
``` js
var http = require('http'),
- caronte = require('caronte');
+ httpProxy = require('http-proxy');
//
// Create a proxy server with custom application logic
//
-var proxy = caronte.createProxyServer({});
+var proxy = httpProxy.createProxyServer({});
var server = require('http').createServer(function(req, res) {
proxy.web(req, res, { target: 'http://127.0.0.1:5060' });
@@ -103,7 +103,7 @@ server.listen(5050);
### Options
-`caronte.createProxyServer` supports the following options:
+`httpProxy.createProxyServer` supports the following options:
* **target**: url string to be parsed with the url module
* **forward**: url string to be parsed with the url module
@@ -130,7 +130,7 @@ Logo created by [Diego Pasquali](http://dribbble.com/diegopq)
>The MIT License (MIT)
>
->Copyright (c) 2013 Nodejitsu Inc.
+>Copyright (c) 2010 - 2013 Nodejitsu Inc.
>
>Permission is hereby granted, free of charge, to any person obtaining a copy
>of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/error-handling.js b/examples/error-handling.js
index 06b126eb3..f646a8de4 100644
--- a/examples/error-handling.js
+++ b/examples/error-handling.js
@@ -1,17 +1,17 @@
-var caronte = require('../index');
+var httpProxy = require('../index');
/*
* Create your proxy server
*/
-var proxyServer = caronte.createProxyServer({target:'http://localhost:30404', ws:true});
+var proxyServer = httpProxy.createProxyServer({target:'http://localhost:30404', ws:true});
// Register an error handler for web requests
-proxyServer.ee.on("caronte:outgoing:web:error", function(err, req, res){
+proxyServer.ee.on("http-proxy:outgoing:web:error", function(err, req, res){
res.writeHead(502);
res.end("There was an error proxying your request");
});
// Register an error handler for web-socket requests
-proxyServer.ee.on("caronte:outgoing:ws:error", function(err, req, socket, head){
+proxyServer.ee.on("http-proxy:outgoing:ws:error", function(err, req, socket, head){
socket.close();
});
diff --git a/examples/https-secure.js b/examples/https-secure.js
index b6d7bb759..4ddbe8d23 100644
--- a/examples/https-secure.js
+++ b/examples/https-secure.js
@@ -1,4 +1,4 @@
-var caronte = require('caronte'),
+var httpProxy = require('http-proxy'),
https = require('https');
/*
* Create your proxy server pointing to a secure domain
@@ -9,7 +9,7 @@ var options = {target : 'https://google.com',
headers: {host: 'google.com'}
};
-var proxyServer = caronte.createProxyServer(options);
+var proxyServer = httpProxy.createProxyServer(options);
console.log("Proxy server listening on port 8000");
proxyServer.listen(8000);
diff --git a/examples/https.js b/examples/https.js
index b64e3cf2f..7f0aed3e2 100644
--- a/examples/https.js
+++ b/examples/https.js
@@ -1,10 +1,10 @@
-var caronte = require('caronte');
+var httpProxy = require('http-proxy');
/*
* Create your proxy server pointing to a secure domain
*/
var options = {target:'https://google.com'};
-var proxyServer = caronte.createProxyServer(options);
+var proxyServer = httpProxy.createProxyServer(options);
console.log("Proxy server listening on port 8000");
proxyServer.listen(8000);
diff --git a/examples/stand-alone.js b/examples/stand-alone.js
index 081134e6b..3bf6ddccf 100644
--- a/examples/stand-alone.js
+++ b/examples/stand-alone.js
@@ -1,10 +1,10 @@
var http = require('http'),
- caronte = require('caronte');
+ httpProxy = require('http-proxy');
//
// Create your proxy server
//
console.log("Proxy server listening on port 8000");
-caronte.createProxyServer({target:'http://localhost:9000'}).listen(8000);
+httpProxy.createProxyServer({target:'http://localhost:9000'}).listen(8000);
//
// Create your target server
diff --git a/index.js b/index.js
index 68de922bd..e6fac8584 100644
--- a/index.js
+++ b/index.js
@@ -10,4 +10,4 @@
* Dante - The Divine Comedy (Canto III)
*/
-module.exports = require('./lib/caronte');
\ No newline at end of file
+module.exports = require('./lib/http-proxy');
\ No newline at end of file
diff --git a/lib/caronte.js b/lib/http-proxy.js
similarity index 79%
rename from lib/caronte.js
rename to lib/http-proxy.js
index 0bda8cd18..8cabc6fa1 100644
--- a/lib/caronte.js
+++ b/lib/http-proxy.js
@@ -1,16 +1,16 @@
-var http = require('http'),
- https = require('https'),
- url = require('url'),
- caronte = require('./caronte/'),
- events = require('eventemitter2'),
- proxy = exports;
+var http = require('http'),
+ https = require('https'),
+ url = require('url'),
+ httpProxy = require('./http-proxy'),
+ events = require('eventemitter2'),
+ proxy = exports;
/**
* Creates the proxy server.
*
* Examples:
*
- * caronte.createProxyServer({ .. }, 8000)
+ * httpProxy.createProxyServer({ .. }, 8000)
* // => '{ web: [Function], ws: [Function] ... }'
*
* @param {Object} Options Config object passed to the proxy
@@ -20,7 +20,7 @@ var http = require('http'),
* @api public
*/
-proxy.createProxyServer = function createProxyServer(options) {
+proxy.createProxyServer = proxy.createServer = function createProxyServer(options) {
if(!options) {
throw new Error([
"`options` is needed and it must have the following layout:",
@@ -44,8 +44,8 @@ proxy.createProxyServer = function createProxyServer(options) {
return {
ee : options.ee,
- web : caronte.createWebProxy(options),
- ws : caronte.createWsProxy(options),
+ web : httpProxy.createWebProxy(options),
+ ws : httpProxy.createWsProxy(options),
listen : function listen(port) {
var server = options.ssl ? https.createServer(options.ssl, this.web) : http.createServer(this.web);
diff --git a/lib/caronte/common.js b/lib/http-proxy/common.js
similarity index 100%
rename from lib/caronte/common.js
rename to lib/http-proxy/common.js
diff --git a/lib/caronte/index.js b/lib/http-proxy/index.js
similarity index 83%
rename from lib/caronte/index.js
rename to lib/http-proxy/index.js
index 86b79a45f..22d2d5c9b 100644
--- a/lib/caronte/index.js
+++ b/lib/http-proxy/index.js
@@ -1,11 +1,11 @@
-var caronte = exports,
- extend = require('util')._extend,
+var httpProxy = exports,
+ extend = require('util')._extend,
parse_url = require('url').parse,
- web = require('./passes/web-incoming'),
- ws = require('./passes/ws-incoming');
+ web = require('./passes/web-incoming'),
+ ws = require('./passes/ws-incoming');
-caronte.createWebProxy = createRightProxy('web');
-caronte.createWsProxy = createRightProxy('ws');
+httpProxy.createWebProxy = createRightProxy('web');
+httpProxy.createWsProxy = createRightProxy('ws');
/**
* Returns a function that creates the loader for
@@ -13,7 +13,7 @@ caronte.createWsProxy = createRightProxy('ws');
*
* Examples:
*
- * caronte.createRightProxy('ws')
+ * httpProxy.createRightProxy('ws')
* // => [Function]
*
* @param {String} Type Either 'ws' or 'web'
@@ -36,7 +36,7 @@ function createRightProxy(type) {
var self = this,
args = [].slice.call(arguments),
cntr = args.length - 1,
- ev = 'caronte:' + type + ':incoming:',
+ ev = 'http-proxy:' + type + ':incoming:',
head;
if(
diff --git a/lib/caronte/passes/web-incoming.js b/lib/http-proxy/passes/web-incoming.js
similarity index 97%
rename from lib/caronte/passes/web-incoming.js
rename to lib/http-proxy/passes/web-incoming.js
index 40eb345c7..8f5afae9d 100644
--- a/lib/caronte/passes/web-incoming.js
+++ b/lib/http-proxy/passes/web-incoming.js
@@ -106,7 +106,7 @@ web_o = Object.keys(web_o).map(function(pass) {
// Error Handler
proxyReq.on('error', function(err){
- var ev = 'caronte:outgoing:web:';
+ var ev = 'http-proxy:outgoing:web:';
// If no error listeners, so throw the error.
if (!options.ee.listeners(ev + 'error').length){
throw err;
@@ -118,7 +118,7 @@ web_o = Object.keys(web_o).map(function(pass) {
req.pipe(proxyReq);
proxyReq.on('response', function(proxyRes) {
- var ev = 'caronte:outgoing:web:';
+ var ev = 'http-proxy:outgoing:web:';
options.ee.emit(ev + 'begin', req, res);
diff --git a/lib/caronte/passes/web-outgoing.js b/lib/http-proxy/passes/web-outgoing.js
similarity index 100%
rename from lib/caronte/passes/web-outgoing.js
rename to lib/http-proxy/passes/web-outgoing.js
diff --git a/lib/caronte/passes/ws-incoming.js b/lib/http-proxy/passes/ws-incoming.js
similarity index 98%
rename from lib/caronte/passes/ws-incoming.js
rename to lib/http-proxy/passes/ws-incoming.js
index 2afec8f55..070cefbb9 100644
--- a/lib/caronte/passes/ws-incoming.js
+++ b/lib/http-proxy/passes/ws-incoming.js
@@ -107,7 +107,7 @@ var passes = exports;
);
// Error Handler
proxyReq.on('error', function(err){
- var ev = 'caronte:outgoing:ws:';
+ var ev = 'http-proxy:outgoing:ws:';
// If no error listeners, so throw the error.
if (!options.ee.listeners(ev + 'error').length){
throw err;
diff --git a/package.json b/package.json
index 22406ba23..a4f653b5d 100644
--- a/package.json
+++ b/package.json
@@ -1,9 +1,13 @@
{
- "name" : "caronte",
- "version" : "0.0.0",
+ "name" : "http-proxy",
+ "version" : "1.0.0",
"description" : "HTTP proxying for the masses",
- "author" : "yawnt ",
-
+ "author": "Nodejitsu Inc. ",
+ "maintainers" : [
+ "yawnt ",
+ "indexzero "
+ ],
+
"main" : "index.js",
"dependencies" : {
@@ -24,7 +28,7 @@
},
"scripts" : {
"coveralls" : "mocha --require blanket --reporter mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js",
- "blanket" : { "pattern": "lib/caronte" },
+ "blanket" : { "pattern": "lib/http-proxy" },
"test" : "./node_modules/.bin/mocha -R landing test/*-test.js",
"test-cov" : "./node_modules/.bin/mocha --require blanket -R html-cov > cov/coverage.html"
},
diff --git a/test/lib-caronte-common-test.js b/test/lib-caronte-common-test.js
index ac79867c5..2f9fa1ed8 100644
--- a/test/lib-caronte-common-test.js
+++ b/test/lib-caronte-common-test.js
@@ -1,7 +1,7 @@
-var common = require('../lib/caronte/common'),
+var common = require('../lib/http-proxy/common'),
expect = require('expect.js');
-describe('lib/caronte/common.js', function () {
+describe('lib/http-proxy/common.js', function () {
describe('#setupOutgoing', function () {
it('should setup the correct headers', function () {
var outgoing = {};
diff --git a/test/lib-caronte-passes-web-incoming-test.js b/test/lib-caronte-passes-web-incoming-test.js
index cc0a760a7..4269d5f8b 100644
--- a/test/lib-caronte-passes-web-incoming-test.js
+++ b/test/lib-caronte-passes-web-incoming-test.js
@@ -1,14 +1,14 @@
-var caronte = require('../lib/caronte/passes/web-incoming'),
+var httpProxy = require('../lib/http-proxy/passes/web-incoming'),
expect = require('expect.js');
-describe('lib/caronte/passes/web.js', function() {
+describe('lib/http-proxy/passes/web.js', function() {
describe('#deleteLength', function() {
it('should change `content-length`', function() {
var stubRequest = {
method: 'DELETE',
headers: {}
};
- caronte.deleteLength(stubRequest, {}, {});
+ httpProxy.deleteLength(stubRequest, {}, {});
expect(stubRequest.headers['content-length']).to.eql('0');
})
});
@@ -21,7 +21,7 @@ describe('lib/caronte/passes/web.js', function() {
}
}
- caronte.timeout(stubRequest, {}, { timeout: 5000});
+ httpProxy.timeout(stubRequest, {}, { timeout: 5000});
expect(done).to.eql(5000);
});
});
@@ -36,7 +36,7 @@ describe('lib/caronte/passes/web.js', function() {
}
it('set the correct x-forwarded-* headers', function () {
- caronte.XHeaders(stubRequest, {}, { xfwd: true });
+ httpProxy.XHeaders(stubRequest, {}, { xfwd: true });
expect(stubRequest.headers['x-forwarded-for']).to.be('192.168.1.2');
expect(stubRequest.headers['x-forwarded-port']).to.be('8080');
expect(stubRequest.headers['x-forwarded-proto']).to.be('http');
diff --git a/test/lib-caronte-passes-web-outgoing-test.js b/test/lib-caronte-passes-web-outgoing-test.js
index 64fc7ead9..0ae0bda6f 100644
--- a/test/lib-caronte-passes-web-outgoing-test.js
+++ b/test/lib-caronte-passes-web-outgoing-test.js
@@ -1,11 +1,11 @@
-var caronte = require('../lib/caronte/passes/web-outgoing'),
+var httpProxy = require('../lib/http-proxy/passes/web-outgoing'),
expect = require('expect.js');
-describe('lib/caronte/passes/web-outgoing.js', function () {
+describe('lib/http-proxy/passes/web-outgoing.js', function () {
describe('#setConnection', function () {
it('set the right connection with 1.0 - `close`', function() {
var proxyRes = { headers: {} };
- caronte.setConnection({
+ httpProxy.setConnection({
httpVersion: '1.0',
headers: {
connection: null
@@ -17,7 +17,7 @@ describe('lib/caronte/passes/web-outgoing.js', function () {
it('set the right connection with 1.0 - req.connection', function() {
var proxyRes = { headers: {} };
- caronte.setConnection({
+ httpProxy.setConnection({
httpVersion: '1.0',
headers: {
connection: 'hey'
@@ -29,7 +29,7 @@ describe('lib/caronte/passes/web-outgoing.js', function () {
it('set the right connection - req.connection', function() {
var proxyRes = { headers: {} };
- caronte.setConnection({
+ httpProxy.setConnection({
httpVersion: null,
headers: {
connection: 'hola'
@@ -41,7 +41,7 @@ describe('lib/caronte/passes/web-outgoing.js', function () {
it('set the right connection - `keep-alive`', function() {
var proxyRes = { headers: {} };
- caronte.setConnection({
+ httpProxy.setConnection({
httpVersion: null,
headers: {
connection: null
@@ -61,7 +61,7 @@ describe('lib/caronte/passes/web-outgoing.js', function () {
}
}
- caronte.writeStatusCode({}, res, { statusCode: 200 });
+ httpProxy.writeStatusCode({}, res, { statusCode: 200 });
});
});
@@ -80,7 +80,7 @@ describe('lib/caronte/passes/web-outgoing.js', function () {
headers: {}
};
- caronte.writeHeaders({}, res, proxyRes);
+ httpProxy.writeHeaders({}, res, proxyRes);
expect(res.headers.hey).to.eql('hello');
expect(res.headers.how).to.eql('are you?');
@@ -95,7 +95,7 @@ describe('lib/caronte/passes/web-outgoing.js', function () {
};
- caronte.removeChunked({ httpVersion: '1.0' }, {}, proxyRes);
+ httpProxy.removeChunked({ httpVersion: '1.0' }, {}, proxyRes);
expect(proxyRes.headers['transfer-encoding']).to.eql(undefined);
});
diff --git a/test/lib-caronte-passes-ws-incoming-test.js b/test/lib-caronte-passes-ws-incoming-test.js
index 2c077d4df..87dfcef94 100644
--- a/test/lib-caronte-passes-ws-incoming-test.js
+++ b/test/lib-caronte-passes-ws-incoming-test.js
@@ -1,7 +1,7 @@
-var caronte = require('../lib/caronte/passes/ws-incoming'),
+var httpProxy = require('../lib/http-proxy/passes/ws-incoming'),
expect = require('expect.js');
-describe('lib/caronte/passes/ws-incoming.js', function () {
+describe('lib/http-proxy/passes/ws-incoming.js', function () {
describe('#checkMethodAndHeader', function () {
it('should drop non-GET connections', function () {
var destroyCalled = false,
@@ -15,7 +15,7 @@ describe('lib/caronte/passes/ws-incoming.js', function () {
destroyCalled = true;
}
}
- returnValue = caronte.checkMethodAndHeader(stubRequest, stubSocket);
+ returnValue = httpProxy.checkMethodAndHeader(stubRequest, stubSocket);
expect(returnValue).to.be(true);
expect(destroyCalled).to.be(true);
})
@@ -32,7 +32,7 @@ describe('lib/caronte/passes/ws-incoming.js', function () {
destroyCalled = true;
}
}
- returnValue = caronte.checkMethodAndHeader(stubRequest, stubSocket);
+ returnValue = httpProxy.checkMethodAndHeader(stubRequest, stubSocket);
expect(returnValue).to.be(true);
expect(destroyCalled).to.be(true);
})
@@ -51,7 +51,7 @@ describe('lib/caronte/passes/ws-incoming.js', function () {
destroyCalled = true;
}
}
- returnValue = caronte.checkMethodAndHeader(stubRequest, stubSocket);
+ returnValue = httpProxy.checkMethodAndHeader(stubRequest, stubSocket);
expect(returnValue).to.be(true);
expect(destroyCalled).to.be(true);
})
@@ -70,7 +70,7 @@ describe('lib/caronte/passes/ws-incoming.js', function () {
destroyCalled = true;
}
}
- returnValue = caronte.checkMethodAndHeader(stubRequest, stubSocket);
+ returnValue = httpProxy.checkMethodAndHeader(stubRequest, stubSocket);
expect(returnValue).to.be(undefined);
expect(destroyCalled).to.be(false);
})
@@ -97,7 +97,7 @@ describe('lib/caronte/passes/ws-incoming.js', function () {
nodelay: false,
keepalive: false
},
- returnValue = caronte.setupSocket({}, stubSocket);
+ returnValue = httpProxy.setupSocket({}, stubSocket);
expect(returnValue).to.be(undefined);
expect(socketConfig.timeout).to.eql(0);
expect(socketConfig.nodelay).to.eql(true);
@@ -107,7 +107,7 @@ describe('lib/caronte/passes/ws-incoming.js', function () {
describe('#XHeaders', function () {
it('return if no forward request', function () {
- var returnValue = caronte.XHeaders({}, {}, {});
+ var returnValue = httpProxy.XHeaders({}, {}, {});
expect(returnValue).to.be(undefined);
});
@@ -119,7 +119,7 @@ describe('lib/caronte/passes/ws-incoming.js', function () {
},
headers: {}
}
- caronte.XHeaders(stubRequest, {}, { xfwd: true });
+ httpProxy.XHeaders(stubRequest, {}, { xfwd: true });
expect(stubRequest.headers['x-forwarded-for']).to.be('192.168.1.2');
expect(stubRequest.headers['x-forwarded-port']).to.be('8080');
expect(stubRequest.headers['x-forwarded-proto']).to.be('ws');
@@ -136,7 +136,7 @@ describe('lib/caronte/passes/ws-incoming.js', function () {
},
headers: {}
};
- caronte.XHeaders(stubRequest, {}, { xfwd: true });
+ httpProxy.XHeaders(stubRequest, {}, { xfwd: true });
expect(stubRequest.headers['x-forwarded-for']).to.be('192.168.1.3');
expect(stubRequest.headers['x-forwarded-port']).to.be('8181');
expect(stubRequest.headers['x-forwarded-proto']).to.be('wss');
diff --git a/test/lib-caronte-test.js b/test/lib-caronte-test.js
index 0558ef934..b9aa8af7f 100644
--- a/test/lib-caronte-test.js
+++ b/test/lib-caronte-test.js
@@ -1,17 +1,17 @@
-var caronte = require('../lib/caronte'),
- expect = require('expect.js'),
- http = require('http'),
- ws = require('ws')
- io = require('socket.io'),
- ioClient = require('socket.io-client');
+var httpProxy = require('../lib/http-proxy'),
+ expect = require('expect.js'),
+ http = require('http'),
+ ws = require('ws')
+ io = require('socket.io'),
+ ioClient = require('socket.io-client');
-describe('lib/caronte.js', function() {
+describe('lib/http-proxy.js', function() {
describe('#createProxyServer', function() {
it('should throw without options', function() {
var error;
try {
- caronte.createProxyServer();
+ httpProxy.createProxyServer();
} catch(e) {
error = e;
}
@@ -20,7 +20,7 @@ describe('lib/caronte.js', function() {
})
it('should return an object otherwise', function() {
- var obj = caronte.createProxyServer({
+ var obj = httpProxy.createProxyServer({
target: 'http://www.google.com:80'
});
@@ -32,7 +32,7 @@ describe('lib/caronte.js', function() {
describe('#createProxyServer with forward options and using web-incoming passes', function () {
it('should pipe the request using web-incoming#stream method', function (done) {
- var proxy = caronte.createProxyServer({
+ var proxy = httpProxy.createProxyServer({
forward: 'http://127.0.0.1:8080'
}).listen('8081')
@@ -52,7 +52,7 @@ describe('lib/caronte.js', function() {
describe('#createProxyServer using the web-incoming passes', function () {
it('should make the request on pipe and finish it', function(done) {
- var proxy = caronte.createProxyServer({
+ var proxy = httpProxy.createProxyServer({
target: 'http://127.0.0.1:8080'
}).listen('8081');
@@ -80,7 +80,7 @@ describe('lib/caronte.js', function() {
describe('#createProxyServer using the web-incoming passes', function () {
it('should make the request, handle response and finish it', function(done) {
- var proxy = caronte.createProxyServer({
+ var proxy = httpProxy.createProxyServer({
target: 'http://127.0.0.1:8080'
}).listen('8081');
@@ -115,11 +115,11 @@ describe('lib/caronte.js', function() {
describe('#createProxyServer() method with error response', function () {
it('should make the request and emit the error event', function(done) {
- var proxy = caronte.createProxyServer({
+ var proxy = httpProxy.createProxyServer({
target: 'http://127.0.0.1:8080'
});
- proxy.ee.on('caronte:outgoing:web:error', function (err) {
+ proxy.ee.on('http-proxy:outgoing:web:error', function (err) {
expect(err).to.be.an(Error);
expect(err.code).to.be('ECONNREFUSED');
proxyServer.close();
@@ -138,7 +138,7 @@ describe('lib/caronte.js', function() {
describe('#createProxyServer using the web-incoming passes', function () {
it('should emit events correclty', function(done) {
- var proxy = caronte.createProxyServer({
+ var proxy = httpProxy.createProxyServer({
target: 'http://127.0.0.1:8080'
}),
@@ -155,7 +155,7 @@ describe('lib/caronte.js', function() {
source.listen('8080');
- proxy.ee.on('caronte:**', function (uno, dos, tres) {
+ proxy.ee.on('http-proxy:**', function (uno, dos, tres) {
events.push(this.event);
})
@@ -171,8 +171,8 @@ describe('lib/caronte.js', function() {
});
res.on('end', function () {
- expect(events).to.contain('caronte:outgoing:web:begin');
- expect(events).to.contain('caronte:outgoing:web:end');
+ expect(events).to.contain('http-proxy:outgoing:web:begin');
+ expect(events).to.contain('http-proxy:outgoing:web:end');
source.close();
proxyServer.close();
done();
@@ -183,7 +183,7 @@ describe('lib/caronte.js', function() {
describe('#createProxyServer using the ws-incoming passes', function () {
it('should proxy the websockets stream', function (done) {
- var proxy = caronte.createProxyServer({
+ var proxy = httpProxy.createProxyServer({
target: 'ws://127.0.0.1:8080',
ws: true
}),
@@ -215,7 +215,7 @@ describe('lib/caronte.js', function() {
describe('#createProxyServer using the ws-incoming passes', function () {
it('should proxy a socket.io stream', function (done) {
- var proxy = caronte.createProxyServer({
+ var proxy = httpProxy.createProxyServer({
target: 'ws://127.0.0.1:8080',
ws: true
}),