Skip to content

Commit

Permalink
Correct the type of DispatchOptions["headers"]
Browse files Browse the repository at this point in the history
According to core/util@parseHeaders, the current behavior is:

- By default, the entry type is a `string`.
- The entry type turns to a `string[]` when there are duplicated entries

This behavior is not as same as what `node:http` does currently;
therefore, `IncomingHttpHeaders` can't reflect our parsed data.

This commit attempts to reflect this parsing behavior.

Fixed nodejs#1892

Signed-off-by: pan93412 <pan93412@gmail.com>
  • Loading branch information
pan93412 committed Jan 29, 2023
1 parent 196c4da commit 35b391f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion types/dispatcher.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ declare namespace Dispatcher {
/** Default: `null` */
body?: string | Buffer | Uint8Array | Readable | null | FormData;
/** Default: `null` */
headers?: IncomingHttpHeaders | string[] | null;
headers?: Record<string, string | string[]> | null;
/** Query string params to be embedded in the request URL. Default: `null` */
query?: Record<string, any>;
/** Whether the requests can be safely retried or not. If `false` the request won't be sent until all preceding requests in the pipeline have completed. Default: `true` if `method` is `HEAD` or `GET`. */
Expand Down

0 comments on commit 35b391f

Please sign in to comment.