Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
fix: types for outgoing http headers
Browse files Browse the repository at this point in the history
  • Loading branch information
boopathi authored and grassator committed Jun 19, 2019
1 parent d964956 commit 3da35d2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,25 @@ const getInterval = (time: [number, number]): number => {
return Math.round(diff[0] * 1000 + diff[1] / 1000000);
};

/**
* The NodeJS typescript definitions has OutgoingHttpHeaders
* with `undefined` as one of the possible values, but NodeJS
* runtime will throw an error for undefined values in headers.
*
* This overwrites the headers type in the RequestOptions
* and removes undefined from one of the possible values of headers.
*/
export interface OutgoingHttpHeaders {
[header: string]: number | string | string[];
}

export interface ServiceClientRequestOptions extends RequestOptions {
pathname: string;
query?: object;
timing?: boolean;
dropRequestAfter?: number;
body?: any;
headers?: OutgoingHttpHeaders;
}

export class ServiceClientResponse {
Expand Down

0 comments on commit 3da35d2

Please sign in to comment.