http-proxy-middleware 0.21.0-beta.3 → 1.0.1
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/CHANGELOG.md +12 -2
- package/README.md +98 -67
- package/dist/config-factory.js +9 -12
- package/dist/context-matcher.js +9 -12
- package/dist/handlers.js +7 -17
- package/dist/http-proxy-middleware.d.ts +2 -2
- package/dist/http-proxy-middleware.js +8 -18
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -2
- package/dist/logger.js +5 -8
- package/dist/path-rewriter.js +10 -13
- package/dist/router.js +4 -7
- package/dist/tsconfig.tsbuildinfo +2911 -0
- package/dist/types.d.ts +17 -17
- package/package.json +23 -17
package/dist/types.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import express from 'express';
|
|
3
|
-
import http from 'http';
|
|
4
|
-
import httpProxy from 'http-proxy';
|
|
5
|
-
import net from 'net';
|
|
6
|
-
export interface
|
|
2
|
+
import * as express from 'express';
|
|
3
|
+
import * as http from 'http';
|
|
4
|
+
import * as httpProxy from 'http-proxy';
|
|
5
|
+
import * as net from 'net';
|
|
6
|
+
export interface Request extends express.Request {
|
|
7
7
|
}
|
|
8
|
-
export interface
|
|
8
|
+
export interface Response extends express.Response {
|
|
9
9
|
}
|
|
10
|
-
export interface
|
|
11
|
-
upgrade?: (req:
|
|
10
|
+
export interface RequestHandler extends express.RequestHandler {
|
|
11
|
+
upgrade?: (req: Request, socket: net.Socket, head: any) => void;
|
|
12
12
|
}
|
|
13
|
-
export declare type Filter = string | string[] | ((pathname: string, req:
|
|
13
|
+
export declare type Filter = string | string[] | ((pathname: string, req: Request) => boolean);
|
|
14
14
|
export interface Options extends httpProxy.ServerOptions {
|
|
15
15
|
pathRewrite?: {
|
|
16
16
|
[regexp: string]: string;
|
|
17
|
-
} | ((path: string, req:
|
|
17
|
+
} | ((path: string, req: Request) => string) | ((path: string, req: Request) => Promise<string>);
|
|
18
18
|
router?: {
|
|
19
|
-
[hostOrPath: string]:
|
|
20
|
-
} | ((req:
|
|
19
|
+
[hostOrPath: string]: httpProxy.ServerOptions['target'];
|
|
20
|
+
} | ((req: Request) => httpProxy.ServerOptions['target']) | ((req: Request) => Promise<httpProxy.ServerOptions['target']>);
|
|
21
21
|
logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
22
22
|
logProvider?(provider: LogProvider): LogProvider;
|
|
23
|
-
onError?(err: Error, req:
|
|
24
|
-
onProxyRes?(proxyRes: http.
|
|
25
|
-
onProxyReq?(proxyReq: http.ClientRequest, req:
|
|
26
|
-
onProxyReqWs?(proxyReq: http.ClientRequest, req:
|
|
23
|
+
onError?(err: Error, req: Request, res: Response): void;
|
|
24
|
+
onProxyRes?(proxyRes: http.IncomingMessage, req: Request, res: Response): void;
|
|
25
|
+
onProxyReq?(proxyReq: http.ClientRequest, req: Request, res: Response): void;
|
|
26
|
+
onProxyReqWs?(proxyReq: http.ClientRequest, req: Request, socket: net.Socket, options: httpProxy.ServerOptions, head: any): void;
|
|
27
27
|
onOpen?(proxySocket: net.Socket): void;
|
|
28
|
-
onClose?(res:
|
|
28
|
+
onClose?(res: Response, socket: net.Socket, head: any): void;
|
|
29
29
|
}
|
|
30
30
|
interface LogProvider {
|
|
31
31
|
log: Logger;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "http-proxy-middleware",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "The one-liner node.js proxy middleware for connect, express and browser-sync",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"lint:fix": "prettier --write \"**/*.{js,ts,md}\"",
|
|
16
16
|
"build": "tsc",
|
|
17
17
|
"pretest": "yarn build",
|
|
18
|
-
"test": "jest
|
|
18
|
+
"test": "jest",
|
|
19
19
|
"precover": "yarn clean && yarn build",
|
|
20
|
-
"cover": "jest --
|
|
20
|
+
"cover": "jest --coverage",
|
|
21
21
|
"precoveralls": "yarn clean && yarn build",
|
|
22
|
-
"coveralls": "jest --
|
|
22
|
+
"coveralls": "jest --coverage --coverageReporters=text-lcov | coveralls",
|
|
23
23
|
"postcoveralls": "yarn clean",
|
|
24
24
|
"prepare": "yarn clean && yarn build"
|
|
25
25
|
},
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"https",
|
|
36
36
|
"connect",
|
|
37
37
|
"express",
|
|
38
|
+
"polka",
|
|
38
39
|
"browser-sync",
|
|
39
40
|
"gulp",
|
|
40
41
|
"grunt-contrib-connect",
|
|
@@ -47,29 +48,33 @@
|
|
|
47
48
|
"bugs": {
|
|
48
49
|
"url": "https://github.com/chimurai/http-proxy-middleware/issues"
|
|
49
50
|
},
|
|
50
|
-
"homepage": "https://github.com/chimurai/http-proxy-middleware",
|
|
51
|
+
"homepage": "https://github.com/chimurai/http-proxy-middleware#readme",
|
|
51
52
|
"devDependencies": {
|
|
52
|
-
"@commitlint/cli": "^8.
|
|
53
|
-
"@commitlint/config-conventional": "^8.
|
|
54
|
-
"@types/express": "^4.17.
|
|
55
|
-
"@types/is-glob": "^4.0.
|
|
56
|
-
"@types/jest": "^25.1.
|
|
53
|
+
"@commitlint/cli": "^8.3.5",
|
|
54
|
+
"@commitlint/config-conventional": "^8.3.4",
|
|
55
|
+
"@types/express": "^4.17.2",
|
|
56
|
+
"@types/is-glob": "^4.0.1",
|
|
57
|
+
"@types/jest": "^25.1.3",
|
|
57
58
|
"@types/lodash": "^4.14.149",
|
|
58
59
|
"@types/micromatch": "^4.0.1",
|
|
59
|
-
"@types/node": "^
|
|
60
|
+
"@types/node": "^13.7.4",
|
|
61
|
+
"@types/supertest": "^2.0.8",
|
|
60
62
|
"browser-sync": "^2.26.7",
|
|
61
|
-
"connect": "^3.
|
|
63
|
+
"connect": "^3.7.0",
|
|
62
64
|
"coveralls": "^3.0.5",
|
|
63
|
-
"express": "^4.
|
|
64
|
-
"husky": "^
|
|
65
|
+
"express": "^4.17.1",
|
|
66
|
+
"husky": "^4.2.3",
|
|
65
67
|
"jest": "^25.1.0",
|
|
68
|
+
"lint-staged": "^10.0.7",
|
|
69
|
+
"mockttp": "^0.19.3",
|
|
66
70
|
"open": "^7.0.2",
|
|
67
71
|
"prettier": "^1.19.1",
|
|
72
|
+
"supertest": "^4.0.2",
|
|
68
73
|
"ts-jest": "^25.2.0",
|
|
69
74
|
"tslint": "^6.0.0",
|
|
70
75
|
"tslint-config-prettier": "^1.18.0",
|
|
71
|
-
"typescript": "^3.
|
|
72
|
-
"ws": "^7.1
|
|
76
|
+
"typescript": "^3.8.2",
|
|
77
|
+
"ws": "^7.2.1"
|
|
73
78
|
},
|
|
74
79
|
"dependencies": {
|
|
75
80
|
"@types/http-proxy": "^1.17.3",
|
|
@@ -83,7 +88,8 @@
|
|
|
83
88
|
},
|
|
84
89
|
"husky": {
|
|
85
90
|
"hooks": {
|
|
86
|
-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
|
91
|
+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
|
|
92
|
+
"pre-commit": "lint-staged"
|
|
87
93
|
}
|
|
88
94
|
},
|
|
89
95
|
"commitlint": {
|