Skip to content

Commit

Permalink
fix: headers types
Browse files Browse the repository at this point in the history
  • Loading branch information
eddienubes committed Aug 25, 2024
1 parent f1dc48f commit 6c0035c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/SageHttpResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ export class SageHttpResponse<T = any> {
get(header: string): string | null;
get(header: string | 'Set-Cookie'): string | string[] | null {
header = header.toLowerCase();
const value = this.headers[header];
// Undefined isn't respect in SageHeaders, so we need to check it here
const value: string | string[] | undefined = this.headers[header];

if (value === undefined) {
return null;
Expand All @@ -96,4 +97,5 @@ export class SageHttpResponse<T = any> {
}
}

export type SageResponseHeaders = Record<string, string | string[] | undefined>;
// Potentially header could be undefined, however, this is too much to check when writing tests
export type SageResponseHeaders = Record<string, string | string[]>;

0 comments on commit 6c0035c

Please sign in to comment.