Skip to content

Commit

Permalink
chore: move proxy:null to correct test
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys authored and wraithgar committed Nov 13, 2023
1 parent eb18944 commit cfdcf70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
9 changes: 2 additions & 7 deletions test/fixtures/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const { join } = require('path')
const http = require('http')
const https = require('https')
const timers = require('timers/promises')
const { pipeline } = require('stream/promises')
const fetch = require('minipass-fetch')

const parseAuthHeader = (header) => {
Expand Down Expand Up @@ -206,12 +205,8 @@ class HttpProxy extends Server {
}

res.writeHead(clientRes.statusCode, clientRes.headers)

try {
await pipeline(clientRes, res)
} catch (err) {
return res.end('proxy pipeline error: ' + err.message)
}
clientRes.pipe(res)
clientRes.once('error', () => res.end())
}

#onConnect = async (req, socket) => {
Expand Down
4 changes: 2 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ t.test('getAgent', (t) => {

const { getAgent: getEnvAgent, HttpAgent: EnvHttpAgent } = t.mock('../lib/index.js')

const agent = getEnvAgent('http://localhost')
const agent = getEnvAgent('http://localhost', { proxy: null })
t.type(agent, EnvHttpAgent)
t.hasStrict(agent, {
proxy: {
Expand All @@ -174,7 +174,7 @@ t.test('getAgent', (t) => {

const { getAgent: getEnvAgent, HttpsAgent: EnvHttpsAgent } = t.mock('../lib/index.js')

const agent = getEnvAgent('https://localhost', { proxy: null })
const agent = getEnvAgent('https://localhost')
t.type(agent, EnvHttpsAgent)
t.notOk(agent.proxy.url)

Expand Down

0 comments on commit cfdcf70

Please sign in to comment.