UNPKG

@helia/verified-fetch

Version:

A fetch-like API for obtaining verified & trustless IPFS content on the web

27 lines 1.69 kB
import type { ByteRangeContext } from './byte-range-context.js'; import type { SupportedBodyTypes } from '../types.js'; import type { Logger } from '@libp2p/interface'; export interface ResponseOptions extends ResponseInit { redirected?: boolean; } export declare function okResponse(url: string, body?: SupportedBodyTypes, init?: ResponseOptions): Response; export declare function badGatewayResponse(url: string, body?: SupportedBodyTypes, init?: ResponseInit): Response; export declare function notSupportedResponse(url: string, body?: SupportedBodyTypes, init?: ResponseInit): Response; export declare function notAcceptableResponse(url: string, body?: SupportedBodyTypes, init?: ResponseInit): Response; export declare function notFoundResponse(url: string, body?: SupportedBodyTypes, init?: ResponseInit): Response; export declare function badRequestResponse(url: string, errors: Error | Error[], init?: ResponseInit): Response; export declare function movedPermanentlyResponse(url: string, location: string, init?: ResponseInit): Response; interface RangeOptions { byteRangeContext: ByteRangeContext; log?: Logger; } export declare function okRangeResponse(url: string, body: SupportedBodyTypes, { byteRangeContext, log }: RangeOptions, 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 badRangeResponse(url: string, body?: SupportedBodyTypes, init?: ResponseInit): Response; export {}; //# sourceMappingURL=responses.d.ts.map