import type { SupportedBodyTypes, ContentType, Resource } from '../index.js'; import type { RangeHeader } from './get-range-header.ts'; export interface ResponseOptions extends ResponseInit { redirected?: boolean; } export declare function okResponse(url: Resource, body?: SupportedBodyTypes, init?: ResponseOptions): Response; export declare function internalServerErrorResponse(url: Resource, err: Error, init?: ResponseInit): Response; /** * A 504 Gateway Timeout for when a request made to an upstream server timed out */ export declare function gatewayTimeoutResponse(url: Resource, body?: SupportedBodyTypes, init?: ResponseInit): Response; /** * A 502 Bad Gateway is for when an invalid response was received from an * upstream server. */ export declare function badGatewayResponse(url: Resource, body?: SupportedBodyTypes, init?: ResponseInit): Response; export declare function notImplementedResponse(url: Resource, body?: SupportedBodyTypes, init?: ResponseInit): Response; export declare function notAcceptableResponse(url: Resource, requested: Array>, acceptable: Array>, init?: ResponseInit): Response; export declare function notFoundResponse(url: Resource, body?: SupportedBodyTypes, init?: ResponseInit): Response; export declare function badRequestResponse(url: Resource, errors: Error | Error[], init?: ResponseInit): Response; export declare function movedPermanentlyResponse(url: Resource, location: string, init?: ResponseInit): Response; export declare function notModifiedResponse(url: Resource, headers: Headers, init?: ResponseInit): Response; export interface PartialContent { /** * Yield data from the content starting at `start` (or 0) inclusive and ending * at `end` exclusive */ (offset: number, length: number): AsyncGenerator; } export declare function partialContentResponse(url: Resource, getSlice: PartialContent, range: RangeHeader, documentSize: number | bigint, init?: ResponseOptions): Response; /** * We likely need to catch errors handled by upstream helia libraries if * range-request throws an error. Some examples: * * - The range is out of bounds * - The range is invalid * - The range is not supported for the given type */ export declare function notSatisfiableResponse(url: Resource, documentSize?: number | bigint | string, init?: ResponseInit): Response; /** * Error to indicate that request was formally correct, but Gateway is unable to * return requested data under the additional (usually cache-related) conditions * sent by the client. * * @see https://specs.ipfs.tech/http-gateways/path-gateway/#412-precondition-failed */ export declare function preconditionFailedResponse(url: Resource, init?: ResponseInit): Response; //# sourceMappingURL=responses.d.ts.map