Skip to content

Commit 77295b8

Browse files
authored
Added regression test with undici with a body (#99)
1 parent 15ce3e7 commit 77295b8

File tree

2 files changed

+34
-8
lines changed

2 files changed

+34
-8
lines changed

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,27 @@
2424
},
2525
"homepage": "https://github.com/fastify/fastify-http-proxy#readme",
2626
"devDependencies": {
27-
"@types/node": "^14.0.18",
28-
"@typescript-eslint/parser": "^3.6.0",
27+
"@types/node": "^14.0.27",
28+
"@typescript-eslint/parser": "^3.7.1",
2929
"eslint-plugin-typescript": "^0.14.0",
3030
"express": "^4.16.4",
31-
"express-http-proxy": "^1.5.0",
31+
"express-http-proxy": "^1.6.2",
3232
"fastify": "^3.0.0",
33-
"got": "^11.4.0",
33+
"got": "^11.5.1",
3434
"http-errors": "^1.8.0",
3535
"http-proxy": "^1.17.0",
3636
"make-promises-safe": "^5.0.0",
3737
"pre-commit": "^1.2.2",
3838
"simple-get": "^4.0.0",
3939
"snazzy": "^8.0.0",
4040
"standard": "^14.0.2",
41-
"tap": "^14.0.0",
41+
"tap": "^14.10.8",
4242
"tsd": "^0.13.1",
43-
"typescript": "^3.9.6"
43+
"typescript": "^3.9.7"
4444
},
4545
"dependencies": {
46-
"fastify-reply-from": "^3.1.2",
47-
"fastify-websocket": "^2.0.3",
46+
"fastify-reply-from": "^3.1.3",
47+
"fastify-websocket": "^2.0.6",
4848
"ws": "^7.3.1"
4949
},
5050
"tsd": {

test/test.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,32 @@ async function run () {
347347

348348
t.match(body, 'THIS IS ROOT')
349349
})
350+
351+
test('undici POST', async t => {
352+
const proxyServer = Fastify()
353+
354+
proxyServer.register(proxy, {
355+
upstream: `http://localhost:${origin.server.address().port}`,
356+
undici: true
357+
})
358+
359+
await proxyServer.listen(0)
360+
361+
t.tearDown(() => {
362+
proxyServer.close()
363+
})
364+
365+
const {
366+
headers: { location }
367+
} = await got(
368+
`http://localhost:${proxyServer.server.address().port}/this-has-data`,
369+
{
370+
method: 'POST',
371+
json: { hello: 'world' }
372+
}
373+
)
374+
t.equal(location, '/something')
375+
})
350376
}
351377

352378
run()

0 commit comments

Comments
 (0)