UNPKG

mock-xmlhttprequest

Version:
36 lines (34 loc) 1.23 kB
/** * mock-xmlhttprequest v8.4.1 * (c) 2025 Bertrand Guay-Paquet * @license MIT */ import HeadersContainer from './HeadersContainer.mts'; /** * Request parameters from MockXhr.send() */ export default class RequestData { private readonly _requestHeaders; private readonly _method; private readonly _url; private readonly _body; private readonly _credentialsMode; constructor(requestHeaders: HeadersContainer, method: string, url: string, body?: unknown, credentialsMode?: boolean); /** * @returns Request headers container */ get requestHeaders(): HeadersContainer; get method(): string; get url(): string; get body(): any; get withCredentials(): boolean; /** * Note: this isn't completely accurate for a multipart/form-data encoded FormData request body. * MockXhr not consider headers, encoding, and other factors that influence the request body size * of non-mocked XMLHttpRequest. You can consider the value returned by this method as a floor * value for the request body size. This can still be useful to simulate upload progress events. * * @returns Request body's total byte size */ getRequestBodySize(): number; }