@@ -30,7 +30,7 @@ function getFs() {
3030 return _fs as typeof import ( 'node:fs' )
3131}
3232
33- import type { IncomingMessage } from 'http'
33+ import type { IncomingHttpHeaders , IncomingMessage } from 'http'
3434
3535import type { Logger } from './logger.js'
3636
@@ -90,7 +90,7 @@ export interface HttpHookRequestInfo {
9090export interface HttpHookResponseInfo {
9191 duration : number
9292 error ?: Error | undefined
93- headers ?: Record < string , Array < string > | string | undefined > | undefined
93+ headers ?: IncomingHttpHeaders | undefined
9494 method : string
9595 status ?: number | undefined
9696 statusText ?: string | undefined
@@ -326,7 +326,7 @@ export interface HttpResponse {
326326 * console.log(response.headers['set-cookie']) // May be string[]
327327 * ```
328328 */
329- headers : Record < string , Array < string > | string | undefined >
329+ headers : IncomingHttpHeaders
330330 /**
331331 * Parse response body as JSON.
332332 * Type parameter `T` allows specifying the expected JSON structure.
@@ -1048,10 +1048,7 @@ async function httpRequestAttempt(
10481048 res . headers . location
10491049 ) {
10501050 emitResponse ( {
1051- headers : res . headers as Record <
1052- string ,
1053- Array < string > | string | undefined
1054- > ,
1051+ headers : res . headers ,
10551052 status : res . statusCode ,
10561053 statusText : res . statusMessage ,
10571054 } )
@@ -1129,10 +1126,7 @@ async function httpRequestAttempt(
11291126 )
11301127 } ,
11311128 body : responseBody ,
1132- headers : res . headers as Record <
1133- string ,
1134- Array < string > | string | undefined
1135- > ,
1129+ headers : res . headers ,
11361130 json < T = unknown > ( ) : T {
11371131 return JSON . parse ( responseBody . toString ( 'utf8' ) ) as T
11381132 } ,
@@ -1146,10 +1140,7 @@ async function httpRequestAttempt(
11461140 }
11471141
11481142 emitResponse ( {
1149- headers : res . headers as Record <
1150- string ,
1151- Array < string > | string | undefined
1152- > ,
1143+ headers : res . headers ,
11531144 status : res . statusCode ,
11541145 statusText : res . statusMessage ,
11551146 } )
0 commit comments