Skip to content

Commit

Permalink
feat: removed undefined from sage response headers
Browse files Browse the repository at this point in the history
  • Loading branch information
eddienubes committed Feb 12, 2024
1 parent 87f140e commit 8eaf7d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Sage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
wrapArray,
parseSetCookieHeader
} from './utils.js';
import { SageHttpResponse } from './SageHttpResponse.js';
import { SageHttpResponse, SageResponseHeaders } from './SageHttpResponse.js';
import path from 'node:path';
import { FormDataOptions } from './FormDataOptions.js';
import { createReadStream } from 'node:fs';
Expand Down Expand Up @@ -279,7 +279,7 @@ export class Sage {
statusCode: res.statusCode,
status: res.statusCode,
statusText: statusCodeToMessage(res.statusCode),
headers: res.headers,
headers: res.headers as SageResponseHeaders,
body: json,
text: text,
ok: isOkay(res.statusCode),
Expand Down
4 changes: 3 additions & 1 deletion src/SageHttpResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface SageHttpResponse {
* The mapping of status codes to status messages as defined in the HTTP/1.1 specification
*/
statusText: HttpStatusText;
headers: Record<string, string | string[] | undefined>;
headers: SageResponseHeaders;

/**
* True if the status code falls in the range 200-299
Expand All @@ -46,3 +46,5 @@ export interface SageHttpResponse {
*/
cookies: Record<string, CookieOptions>;
}

export type SageResponseHeaders = Record<string, string | string[]>;

0 comments on commit 8eaf7d3

Please sign in to comment.