/** * Decide if a method may carry a body. Used to gate body serialization. * * Per RFC 9110: GET / HEAD / OPTIONS / TRACE / CONNECT either don't take * a body or it's discouraged enough that we drop it silently. DELETE may * carry a body and is allowed. */ export declare function isPayloadMethod(method: string): boolean; /** * Serialize a body for `fetch`. Plain objects/arrays go through `stringifyJson` * (default `JSON.stringify`) and `content-type: application/json` is set when * the user hasn't picked one. Pass-through for FormData/Blob/URLSearchParams/ * streams/strings. */ export declare function serializeBody(body: unknown, headers: Record, stringifyJson: (value: unknown) => string): BodyInit | null | undefined; /** * Detect whether a response is body-less (HEAD, 204/304/1xx, content-length: 0, * opaque cross-origin response). Used to short-circuit JSON.parse and friends. * Covers misina #27 and #33. */ export declare function isBodylessResponse(response: Response, method: string): boolean; export declare function parseResponseBody(response: Response, method: string, parseJson: (text: string, ctx?: { request: Request; response: Response; }) => unknown, responseType?: "json" | "text" | "arrayBuffer" | "blob" | "stream", request?: Request): Promise;