-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dbeee93
commit 2b30ff6
Showing
23 changed files
with
1,010 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
# Change Log | ||
|
||
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
# [3.7.0](https://github.com/midwayjs/midway/compare/v3.6.1...v3.7.0) (2022-10-29) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
# [3.6.0](https://github.com/midwayjs/midway/compare/v3.5.3...v3.6.0) (2022-10-10) | ||
|
||
### Features | ||
|
||
- add guard ([#2345](https://github.com/midwayjs/midway/issues/2345)) ([1b952a1](https://github.com/midwayjs/midway/commit/1b952a1b09adbb88ff3cff9a2974eb1e37ce53a5)) | ||
|
||
## [3.5.3](https://github.com/midwayjs/midway/compare/v3.5.2...v3.5.3) (2022-09-25) | ||
|
||
### Features | ||
|
||
- add proxyTimeout for httpProxy ([#2308](https://github.com/midwayjs/midway/issues/2308)) ([fb14118](https://github.com/midwayjs/midway/commit/fb141183223098534a075ab20bd3e2c366e40d4a)) | ||
|
||
## [3.5.2](https://github.com/midwayjs/midway/compare/v3.5.1...v3.5.2) (2022-09-08) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
## [3.5.1](https://github.com/midwayjs/midway/compare/v3.5.0...v3.5.1) (2022-09-06) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
# [3.5.0](https://github.com/midwayjs/midway/compare/v3.4.13...v3.5.0) (2022-08-29) | ||
|
||
### Features | ||
|
||
- add retry wrapper for invoke some remote data ([#2271](https://github.com/midwayjs/midway/issues/2271)) ([1c47338](https://github.com/midwayjs/midway/commit/1c473386937293104369cc8e5727c5330de4f85c)) | ||
|
||
## [3.4.13](https://github.com/midwayjs/midway/compare/v3.4.12...v3.4.13) (2022-08-24) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
## [3.4.12](https://github.com/midwayjs/midway/compare/v3.4.11...v3.4.12) (2022-08-20) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
## [3.4.11](https://github.com/midwayjs/midway/compare/v3.4.10...v3.4.11) (2022-08-16) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
## [3.4.10](https://github.com/midwayjs/midway/compare/v3.4.9...v3.4.10) (2022-08-12) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
## [3.4.9](https://github.com/midwayjs/midway/compare/v3.4.8...v3.4.9) (2022-08-10) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
## [3.4.8](https://github.com/midwayjs/midway/compare/v3.4.7...v3.4.8) (2022-08-02) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
## [3.4.7](https://github.com/midwayjs/midway/compare/v3.4.6...v3.4.7) (2022-08-01) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
## [3.4.6](https://github.com/midwayjs/midway/compare/v3.4.5...v3.4.6) (2022-07-31) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
## [3.4.4](https://github.com/midwayjs/midway/compare/v3.4.3...v3.4.4) (2022-07-25) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
## [3.4.3](https://github.com/midwayjs/midway/compare/v3.4.2...v3.4.3) (2022-07-21) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
## [3.4.1](https://github.com/midwayjs/midway/compare/v3.4.0...v3.4.1) (2022-07-20) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
# [3.4.0](https://github.com/midwayjs/midway/compare/v3.4.0-beta.12...v3.4.0) (2022-07-20) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
# [3.4.0-beta.12](https://github.com/midwayjs/midway/compare/v3.4.0-beta.11...v3.4.0-beta.12) (2022-07-20) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
# [3.4.0-beta.11](https://github.com/midwayjs/midway/compare/v3.4.0-beta.10...v3.4.0-beta.11) (2022-07-19) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
# [3.4.0-beta.10](https://github.com/midwayjs/midway/compare/v3.4.0-beta.9...v3.4.0-beta.10) (2022-07-18) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
# [3.4.0-beta.9](https://github.com/midwayjs/midway/compare/v3.4.0-beta.8...v3.4.0-beta.9) (2022-07-14) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
# [3.4.0-beta.8](https://github.com/midwayjs/midway/compare/v3.4.0-beta.7...v3.4.0-beta.8) (2022-07-12) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
# [3.4.0-beta.7](https://github.com/midwayjs/midway/compare/v3.4.0-beta.6...v3.4.0-beta.7) (2022-07-12) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
# [3.4.0-beta.6](https://github.com/midwayjs/midway/compare/v3.4.0-beta.5...v3.4.0-beta.6) (2022-07-07) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
# [3.4.0-beta.5](https://github.com/midwayjs/midway/compare/v3.4.0-beta.4...v3.4.0-beta.5) (2022-07-07) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
# [3.4.0-beta.4](https://github.com/midwayjs/midway/compare/v3.4.0-beta.3...v3.4.0-beta.4) (2022-07-04) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
## [3.3.11](https://github.com/midwayjs/midway/compare/v3.3.10...v3.3.11) (2022-05-27) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
## [3.3.9](https://github.com/midwayjs/midway/compare/v3.3.8...v3.3.9) (2022-05-25) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
## [3.3.7](https://github.com/midwayjs/midway/compare/v3.3.6...v3.3.7) (2022-05-13) | ||
|
||
### Bug Fixes | ||
|
||
- koa pipe ([#1973](https://github.com/midwayjs/midway/issues/1973)) ([5cebb76](https://github.com/midwayjs/midway/commit/5cebb76e793abd75bc34dd328d9c1db3d430b58a)) | ||
|
||
## [3.3.6](https://github.com/midwayjs/midway/compare/v3.3.5...v3.3.6) (2022-05-11) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
## [3.3.5](https://github.com/midwayjs/midway/compare/v3.3.4...v3.3.5) (2022-04-27) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
## [3.3.4](https://github.com/midwayjs/midway/compare/v3.3.3...v3.3.4) (2022-04-21) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
## [3.3.3](https://github.com/midwayjs/midway/compare/v3.3.2...v3.3.3) (2022-04-14) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
## [3.3.2](https://github.com/midwayjs/midway/compare/v3.3.1...v3.3.2) (2022-04-13) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
## [3.3.1](https://github.com/midwayjs/midway/compare/v3.3.0...v3.3.1) (2022-04-11) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
# [3.3.0](https://github.com/midwayjs/midway/compare/v3.2.2...v3.3.0) (2022-04-07) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
## [3.2.2](https://github.com/midwayjs/midway/compare/v3.2.1...v3.2.2) (2022-03-30) | ||
|
||
**Note:** Version bump only for package @midwayjs/http-proxy | ||
|
||
## [3.2.1](https://github.com/midwayjs/midway/compare/v3.2.0...v3.2.1) (2022-03-27) | ||
|
||
### Bug Fixes | ||
|
||
- swagger ui replace json path ([#1860](https://github.com/midwayjs/midway/issues/1860)) ([0f3728d](https://github.com/midwayjs/midway/commit/0f3728daccba12923f23f5b498c7dda13ced36d7)) | ||
|
||
# [3.2.0](https://github.com/midwayjs/midway/compare/v3.1.6...v3.2.0) (2022-03-25) | ||
|
||
### Features | ||
|
||
- add http proxy component ([#1843](https://github.com/midwayjs/midway/issues/1843)) ([5281e31](https://github.com/midwayjs/midway/commit/5281e316220591b84a0200c6cdf1572680f6e2f6)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# midwayjs http-proxy-middleware module | ||
|
||
[](http://packagequality.com/#?package=@midwayjs/mongoose) | ||
[](https://github.com/midwayjs/midway/pulls) | ||
|
||
this is a sub package for midway. | ||
|
||
Document: [https://midwayjs.org](https://midwayjs.org) | ||
|
||
## License | ||
|
||
[MIT]((http://github.com/midwayjs/midway/blob/master/LICENSE)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './dist/index'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
testPathIgnorePatterns: ['<rootDir>/test/fixtures'], | ||
coveragePathIgnorePatterns: ['<rootDir>/test/', '<rootDir>/dist/'], | ||
setupFilesAfterEnv: ['./jest.setup.js'], | ||
coverageProvider: 'v8', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
process.env.MIDWAY_TS_MODE = 'true'; | ||
jest.setTimeout(30000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "@midwayjs/http-proxy-middleware", | ||
"version": "3.19.0", | ||
"description": "Midway Component for http proxy middleware", | ||
"main": "dist/index.js", | ||
"typings": "index.d.ts", | ||
"scripts": { | ||
"build": "tsc", | ||
"test": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand", | ||
"cov": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand --coverage --forceExit", | ||
"ci": "npm run test" | ||
}, | ||
"keywords": [ | ||
"midway", | ||
"http", | ||
"proxy" | ||
], | ||
"author": "", | ||
"files": [ | ||
"dist/**/*.js", | ||
"dist/**/*.d.ts", | ||
"index.d.ts" | ||
], | ||
"engines": { | ||
"node": ">=12" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"http-proxy-middleware": "3.0.3", | ||
"koa2-connect": "1.0.2" | ||
}, | ||
"devDependencies": { | ||
"@midwayjs/core": "^3.19.0", | ||
"@midwayjs/express": "^3.19.0", | ||
"@midwayjs/faas": "^3.19.0", | ||
"@midwayjs/koa": "^3.19.0", | ||
"@midwayjs/mock": "^3.19.0", | ||
"@midwayjs/serverless-app": "^3.19.0", | ||
"@midwayjs/web": "^3.19.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { | ||
Configuration, | ||
} from '@midwayjs/core'; | ||
|
||
@Configuration({ | ||
namespace: 'http-proxy-middleware', | ||
}) | ||
export class HttpProxyConfiguration { | ||
async onReady() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { HttpProxyConfiguration as Configuration } from './configuration'; | ||
export * from './middleware'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { | ||
Logger, | ||
Middleware, | ||
IMiddleware, | ||
ILogger, | ||
IMidwayApplication, | ||
} from '@midwayjs/core'; | ||
import { createProxyMiddleware, Options } from 'http-proxy-middleware'; | ||
import * as c2k from 'koa2-connect'; | ||
|
||
@Middleware() | ||
export class HttpProxyMiddleware implements IMiddleware<any, any> { | ||
@Logger() | ||
logger: ILogger; | ||
|
||
resolve(app: IMidwayApplication, proxyOptions: Options<any, any>) { | ||
if (!proxyOptions.logger) { | ||
proxyOptions.logger = this.logger; | ||
} | ||
if (app.getNamespace() === 'express') { | ||
return createProxyMiddleware<Request, Response>(proxyOptions); | ||
} else { | ||
return async function (ctx, next) { | ||
return await c2k(createProxyMiddleware<Request, Response>(proxyOptions))(ctx, next); | ||
Check failure on line 24 in packages/http-proxy-new/src/middleware.ts
|
||
} | ||
} | ||
} | ||
|
||
static getName() { | ||
return 'http-proxy-middleware'; | ||
} | ||
} |
Oops, something went wrong.