Skip to content

Commit 3a7d9a7

Browse files
committed
Test all modules in npm test; fix axios/got/superagent on 4xx
- npm test: explicitly run core, axios, node-fetch, got, undici, superagent - Axios: use validateStatus: () => true so proxy header check works when target returns 4xx - Got: create client with throwHttpErrors: false for same reason - Superagent: chain .ok(() => true) so response is returned on 4xx Made-with: Cursor
1 parent 967f12e commit 3a7d9a7

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"LICENSE"
4040
],
4141
"scripts": {
42-
"test": "node test/test_proxy_headers.js",
42+
"test": "node test/test_proxy_headers.js core axios node-fetch got undici superagent",
4343
"test:verbose": "node test/test_proxy_headers.js -v",
4444
"lint": "eslint lib test",
4545
"prepublishOnly": "npm test"

test/test_proxy_headers.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,9 @@ const AVAILABLE_TESTS = {
189189
proxyHeaders: config.proxyHeadersToSend,
190190
});
191191

192-
const response = await client.get(config.testUrl);
192+
const response = await client.get(config.testUrl, {
193+
validateStatus: () => true,
194+
});
193195
const headerValue = checkHeader(response.headers, config.proxyHeader);
194196

195197
if (headerValue) {
@@ -232,6 +234,7 @@ const AVAILABLE_TESTS = {
232234
const client = await createProxyGot({
233235
proxy: config.proxyUrl,
234236
proxyHeaders: config.proxyHeadersToSend,
237+
gotOptions: { throwHttpErrors: false },
235238
});
236239

237240
const response = await client(config.testUrl);
@@ -279,7 +282,7 @@ const AVAILABLE_TESTS = {
279282
proxyHeaders: config.proxyHeadersToSend,
280283
});
281284

282-
const response = await client.get(config.testUrl);
285+
const response = await client.get(config.testUrl).ok(() => true);
283286
const headerValue = checkHeader(response.headers, config.proxyHeader);
284287

285288
if (headerValue) {

0 commit comments

Comments
 (0)