* bump `@hapi/h2o2` to `9.1.0` * add unit test
This commit is contained in:
parent
b118e40753
commit
e9d67442af
3 changed files with 44 additions and 5 deletions
|
@ -115,7 +115,7 @@
|
|||
"@hapi/boom": "^9.1.1",
|
||||
"@hapi/cookie": "^11.0.2",
|
||||
"@hapi/good-squeeze": "6.0.0",
|
||||
"@hapi/h2o2": "^9.0.2",
|
||||
"@hapi/h2o2": "^9.1.0",
|
||||
"@hapi/hapi": "^20.0.3",
|
||||
"@hapi/hoek": "^9.1.1",
|
||||
"@hapi/inert": "^6.0.3",
|
||||
|
|
|
@ -185,6 +185,45 @@ describe('BasePathProxyServer', () => {
|
|||
});
|
||||
});
|
||||
|
||||
test('forwards request cancellation', async () => {
|
||||
let propagated = false;
|
||||
|
||||
let notifyRequestReceived: () => void;
|
||||
const requestReceived = new Promise<void>((resolve) => {
|
||||
notifyRequestReceived = resolve;
|
||||
});
|
||||
|
||||
let notifyRequestAborted: () => void;
|
||||
const requestAborted = new Promise<void>((resolve) => {
|
||||
notifyRequestAborted = resolve;
|
||||
});
|
||||
|
||||
server.route({
|
||||
method: 'GET',
|
||||
path: `${basePath}/foo/{test}`,
|
||||
handler: async (request, h) => {
|
||||
notifyRequestReceived();
|
||||
|
||||
request.raw.req.once('aborted', () => {
|
||||
notifyRequestAborted();
|
||||
propagated = true;
|
||||
});
|
||||
return await new Promise((resolve) => undefined);
|
||||
},
|
||||
});
|
||||
await server.start();
|
||||
|
||||
const request = proxySupertest.get(`${basePath}/foo/some-string`).end();
|
||||
|
||||
await requestReceived;
|
||||
|
||||
request.abort();
|
||||
|
||||
await requestAborted;
|
||||
|
||||
expect(propagated).toEqual(true);
|
||||
});
|
||||
|
||||
test('handles putting', async () => {
|
||||
server.route({
|
||||
method: 'PUT',
|
||||
|
|
|
@ -1871,10 +1871,10 @@
|
|||
"@hapi/hoek" "9.x.x"
|
||||
fast-safe-stringify "2.x.x"
|
||||
|
||||
"@hapi/h2o2@^9.0.2":
|
||||
version "9.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@hapi/h2o2/-/h2o2-9.0.2.tgz#e9f1dfe789257c80d6ee37ec9fe358f8c69f855a"
|
||||
integrity sha512-V7RsmVyl7uyWeuEko4uaSZbFpBHKcSFSui6PXNRaRLJHFX+iPbqWmeH6m1pW/WJ8DuaCVJFKhluDCDI9l4+1cw==
|
||||
"@hapi/h2o2@^9.1.0":
|
||||
version "9.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@hapi/h2o2/-/h2o2-9.1.0.tgz#b223f4978b6f2b0d7d9db10a84a567606c4c3551"
|
||||
integrity sha512-B7E58bMhxmpiDI22clxTexoAaVShNBk1Ez6S8SQjQZu5FxxD6Tqa44sXeZQBtWrdJF7ZRbsY60/C8AHLRxagNA==
|
||||
dependencies:
|
||||
"@hapi/boom" "9.x.x"
|
||||
"@hapi/hoek" "9.x.x"
|
||||
|
|
Loading…
Reference in a new issue