Skip to content

Commit facb3bc

Browse files
committed
test: assert http2 early 413 closes without reset
1 parent 250e93b commit facb3bc

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

test/server-socket.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import { bodyLimit } from 'hono/body-limit'
33
import fs from 'node:fs'
44
import { request as requestHTTP } from 'node:http'
55
import type { IncomingMessage } from 'node:http'
6-
import { connect as connectHTTP2, createSecureServer as createHTTP2Server } from 'node:http2'
6+
import {
7+
connect as connectHTTP2,
8+
constants as h2constants,
9+
createSecureServer as createHTTP2Server,
10+
} from 'node:http2'
711
import type { ClientHttp2Session } from 'node:http2'
812
import { request as requestHTTPS, createServer as createHTTPSServer } from 'node:https'
913
import { connect as connectNet } from 'node:net'
@@ -293,6 +297,9 @@ describe('autoCleanupIncoming: true (default)', () => {
293297
if (!expectEmptyBody) {
294298
expect(responseBody).toBe('Payload Too Large')
295299
}
300+
if ('rstCode' in req) {
301+
expect(req.rstCode).toBe(h2constants.NGHTTP2_NO_ERROR)
302+
}
296303
// Should not get ECONNRESET before receiving the response
297304
if (requestError) {
298305
expect((requestError as NodeJS.ErrnoException).code).not.toBe('ECONNRESET')

0 commit comments

Comments
 (0)