@whatwg-node/node-fetch
Advanced tools
Comparing version 0.7.6-alpha-20250103123055-7d3b49ae3cf2bf03e15b5c69c5a0b590eb1a0232 to 0.7.6-alpha-20250106140930-8f2bc40b53a3e961bb9767f6e5d6ae64f5bf9866
@@ -104,5 +104,10 @@ "use strict"; | ||
.catch(reject); | ||
const statusCode = nodeResponse.statusCode || 200; | ||
let statusText = nodeResponse.statusMessage || http_1.STATUS_CODES[statusCode]; | ||
if (statusText == null) { | ||
statusText = ''; | ||
} | ||
const ponyfillResponse = new Response_js_1.PonyfillResponse(outputStream, { | ||
status: nodeResponse.statusCode, | ||
statusText: nodeResponse.statusMessage, | ||
status: statusCode, | ||
statusText, | ||
headers: nodeResponse.headers, | ||
@@ -109,0 +114,0 @@ url: fetchRequest.url, |
@@ -1,2 +0,2 @@ | ||
import { request as httpRequest } from 'http'; | ||
import { request as httpRequest, STATUS_CODES } from 'http'; | ||
import { request as httpsRequest } from 'https'; | ||
@@ -101,5 +101,10 @@ import { PassThrough, Readable, promises as streamPromises } from 'stream'; | ||
.catch(reject); | ||
const statusCode = nodeResponse.statusCode || 200; | ||
let statusText = nodeResponse.statusMessage || STATUS_CODES[statusCode]; | ||
if (statusText == null) { | ||
statusText = ''; | ||
} | ||
const ponyfillResponse = new PonyfillResponse(outputStream, { | ||
status: nodeResponse.statusCode, | ||
statusText: nodeResponse.statusMessage, | ||
status: statusCode, | ||
statusText, | ||
headers: nodeResponse.headers, | ||
@@ -106,0 +111,0 @@ url: fetchRequest.url, |
{ | ||
"name": "@whatwg-node/node-fetch", | ||
"version": "0.7.6-alpha-20250103123055-7d3b49ae3cf2bf03e15b5c69c5a0b590eb1a0232", | ||
"version": "0.7.6-alpha-20250106140930-8f2bc40b53a3e961bb9767f6e5d6ae64f5bf9866", | ||
"description": "Fetch API implementation for Node", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
@@ -6,7 +6,7 @@ import { Agent as HTTPAgent } from 'http'; | ||
export type RequestPonyfillInit = PonyfillBodyOptions & Omit<RequestInit, 'body' | 'headers'> & { | ||
body?: BodyPonyfillInit | null; | ||
duplex?: 'half' | 'full'; | ||
headers?: PonyfillHeadersInit; | ||
headersSerializer?: HeadersSerializer; | ||
agent?: HTTPAgent | HTTPSAgent | false; | ||
body?: BodyPonyfillInit | null | undefined; | ||
duplex?: 'half' | 'full' | undefined; | ||
headers?: PonyfillHeadersInit | undefined; | ||
headersSerializer?: HeadersSerializer | undefined; | ||
agent?: HTTPAgent | HTTPSAgent | false | undefined; | ||
}; | ||
@@ -16,3 +16,3 @@ type HeadersSerializer = (headers: Headers, onContentLength?: (contentLength: string) => void) => string[]; | ||
constructor(input: RequestInfo | URL, options?: RequestPonyfillInit); | ||
headersSerializer?: HeadersSerializer; | ||
headersSerializer?: HeadersSerializer | undefined; | ||
cache: RequestCache; | ||
@@ -19,0 +19,0 @@ credentials: RequestCredentials; |
import { BodyPonyfillInit, PonyfillBody, PonyfillBodyOptions } from './Body.js'; | ||
import { PonyfillHeadersInit } from './Headers.js'; | ||
export type ResponsePonyfilInit = PonyfillBodyOptions & Omit<ResponseInit, 'headers'> & { | ||
url?: string; | ||
redirected?: boolean; | ||
headers?: PonyfillHeadersInit; | ||
type?: ResponseType; | ||
url?: string | undefined; | ||
redirected?: boolean | undefined; | ||
headers?: PonyfillHeadersInit | undefined; | ||
type?: ResponseType | undefined; | ||
}; | ||
export declare class PonyfillResponse<TJSON = any> extends PonyfillBody<TJSON> implements Response { | ||
headers: Headers; | ||
constructor(body?: BodyPonyfillInit | null, init?: ResponsePonyfilInit); | ||
constructor(body?: BodyPonyfillInit | null | undefined, init?: ResponsePonyfilInit); | ||
get ok(): boolean; | ||
@@ -13,0 +13,0 @@ status: number; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
220358
5613