Skip to content

Commit 7c0cb83

Browse files
authored
chore: minor improvements (#1185)
1 parent 938aafe commit 7c0cb83

5 files changed

Lines changed: 13 additions & 12 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
// },
4444

4545
// Use 'postCreateCommand' to run commands after the container is created.
46-
"postCreateCommand": "yarn install"
46+
"postCreateCommand": "yarn install && yarn patch-package"
4747

4848
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
4949
// "remoteUser": "root"

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -450,13 +450,12 @@ The following options are provided by the underlying [http-proxy](https://github
450450
- **option.buffer**: stream of data to send as the request body. Maybe you have some middleware that consumes the request stream before proxying it on e.g. If you read the body of a request into a field called 'req.rawbody' you could restream this field in the buffer option:
451451
452452
```javascript
453-
'use strict';
453+
import httpProxy from 'http-proxy';
454+
import streamify from 'stream-array';
454455
455-
const streamify = require('stream-array');
456-
const HttpProxy = require('http-proxy');
457-
const proxy = new HttpProxy();
456+
const proxy = httpProxy.createProxyServer();
458457
459-
module.exports = (req, res, next) => {
458+
export default function proxyWithBody(req, res, next) {
460459
proxy.web(
461460
req,
462461
res,
@@ -466,7 +465,7 @@ The following options are provided by the underlying [http-proxy](https://github
466465
},
467466
next,
468467
);
469-
};
468+
}
470469
```
471470

472471
## WebSocket

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
"install:all": "yarn && (cd examples && yarn)",
2121
"lint": "yarn prettier && yarn eslint",
2222
"lint:fix": "yarn prettier:fix && yarn eslint:fix",
23-
"eslint": "eslint '{src,test,examples}/**/*.{js,ts}' --cache",
23+
"eslint": "eslint --cache '**/*.{js,ts,mjs,mts}'",
2424
"eslint:fix": "yarn eslint --fix",
25-
"prettier": "prettier --list-different \"**/*.{js,ts,md,yml,json,html}\"",
26-
"prettier:fix": "prettier --write \"**/*.{js,ts,md,yml,json,html}\"",
25+
"prettier": "prettier --list-different \"**/*.{js,ts,mjs,mts,md,yml,json,html}\"",
26+
"prettier:fix": "prettier --write \"**/*.{js,ts,mjs,mts,md,yml,json,html}\"",
2727
"build": "tsc --build",
2828
"test": "vitest run",
2929
"test:types": "tsc --project tsconfig.test.json --noEmit",

test/e2e/router.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import { createApp, createAppWithPath, createProxyMiddleware } from './test-kit.
88

99
const untrustedCACert = generateCACertificate({ bits: 2048 });
1010

11-
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
11+
// NOTE: Seems to be not needed when using `ignoreHostHttpsErrors` in mockttp, but leaving it here just in case
12+
// process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
1213

1314
describe('E2E router', () => {
1415
let targetServerA: Mockttp;

tsconfig.test.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
44
"rootDir": ".",
5+
"incremental": false,
56
"noEmit": true
67
},
7-
"include": ["./src/**/*.ts", "./test/**/*.ts"]
8+
"include": ["./src/**/*.ts", "./test/**/*.ts", "./vitest.config.ts"]
89
}

0 commit comments

Comments
 (0)