UNPKG

mock-xmlhttprequest

Version:
53 lines (51 loc) 1.7 kB
/** * mock-xmlhttprequest v8.4.1 * (c) 2025 Bertrand Guay-Paquet * @license MIT */ export declare function getBodyByteSize(body?: unknown): number; /** * https://datatracker.ietf.org/doc/html/rfc7230#section-3.2 * @param headerName Header name * @returns Whether headerName is a valid header name */ export declare function isHeaderName(headerName?: string): boolean; /** * https://fetch.spec.whatwg.org/#header-value * @param headerValue Header value * @returns Whether headerValue is a valid header value */ export declare function isHeaderValue(headerValue: string): boolean; /** * See https://fetch.spec.whatwg.org/#forbidden-header-name * * @param name Header name * @returns Whether the request header name is forbidden for XMLHttpRequest */ export declare function isRequestHeaderForbidden(name: string): boolean; /** * See https://datatracker.ietf.org/doc/html/rfc7230#section-3.1.1 * @param method Method name * @returns Whether method is a valid request method */ export declare function isRequestMethod(method?: string): boolean; /** * See https://fetch.spec.whatwg.org/#forbidden-method * * @param method Method name * @returns Whether the request method is forbidden for XMLHttpRequest */ export declare function isRequestMethodForbidden(method: string): boolean; export declare const upperCaseMethods: string[]; /** * See https://fetch.spec.whatwg.org/#concept-method-normalize * * @param method HTTP method name * @returns Normalized method name */ export declare function normalizeHTTPMethodName(method: string): string; /** * @param status HTTP status code * @returns Status text */ export declare function getStatusText(status: number): string;