Skip to main content
Module

x/ky/source/core/constants.ts

🌳 Tiny & elegant JavaScript HTTP client based on the browser Fetch API
Go to Latest
File
import type {Expect, Equal} from '@type-challenges/utils';import {HttpMethod} from '../types/options.js';
export const supportsAbortController = typeof globalThis.AbortController === 'function';export const supportsStreams = typeof globalThis.ReadableStream === 'function';export const supportsFormData = typeof globalThis.FormData === 'function';
export const requestMethods = ['get', 'post', 'put', 'patch', 'head', 'delete'] as const;
const validate = <T extends Array<true>>() => undefined as unknown as T;validate<[ Expect<Equal<typeof requestMethods[number], HttpMethod>>,]>();
export const responseTypes = { json: 'application/json', text: 'text/*', formData: 'multipart/form-data', arrayBuffer: '*/*', blob: '*/*',} as const;
// The maximum value of a 32bit int (see issue #117)export const maxSafeTimeout = 2_147_483_647;
export const stop = Symbol('stop');