test: replace supertest (#379) · honojs/node-server@3b1dd68 · GitHub
Skip to content

Commit 3b1dd68

Browse files
test: replace supertest (#379)
* test: replace supertest * chore: format
1 parent 834e54f commit 3b1dd68

11 files changed

Lines changed: 875 additions & 948 deletions

File tree

‎package.json‎

Lines changed: 0 additions & 2 deletions

‎pnpm-lock.yaml‎

Lines changed: 0 additions & 372 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/request.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ export class Request extends GlobalRequest {
4343
}
4444
}
4545

46-
export const newHeadersFromIncoming = (incoming: IncomingMessage | Http2ServerRequest) => {
46+
export const newHeadersFromIncoming = (
47+
incoming: Pick<IncomingMessage | Http2ServerRequest, 'rawHeaders'>
48+
) => {
4749
const headerRecord: [string, string][] = []
4850
const rawHeaders = incoming.rawHeaders
4951
for (let i = 0, len = rawHeaders.length; i < len; i += 2) {
@@ -715,7 +717,9 @@ Object.defineProperty(requestPrototype, 'blob', {
715717
return readBodyWithFastPath(this, 'blob', (buf, request) => {
716718
const type = contentType(request)
717719
const init = type ? { headers: { 'content-type': type } } : undefined
718-
return new Response(buf, init).blob()
720+
// Buffer is typed over ArrayBufferLike, but request bodies are always
721+
// backed by an ArrayBuffer, so cast instead of copying the bytes
722+
return new Response(buf as Uint8Array<ArrayBuffer>, init).blob()
719723
})
720724
},
721725
})
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
�Hello br Compressed
1+
Hello br Compressed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
�Hello br Compressed
1+
Hello br Compressed

‎test/helpers/request.ts‎

Lines changed: 154 additions & 17 deletions

0 commit comments

Comments
 (0)