import { WindowTypeOfRequestProxy } from "../Interceptor.types"; import { RequestProxy } from "./RequestProxy"; export declare const CYPRESS_ENV_KEY_XHR_PROXY_DISABLED = "__xhrProxyDisabled"; /** * !! IMPORTANT !! * There is a bug in the XMLHttpRequest implementation in Cypress. When use a wrapped function like: * * @example * ```ts * set onreadystatechange(value: (this: XMLHttpRequest, ev: Event) => unknown) { * // this is the wrapped function where the issue is * super.onreadystatechange = (ev) => { * value.call(this, ev); * } * * // this would work without any issue, but we need to use the wrapped function * // super.onreadystatechange = value; * } * ``` * * And use a relative path like: * * @example * ```ts * const req = new XMLHttpRequest(); * * // when executed on `http://localhost/page.html` * req.open("GET", "http://localhost/test", true); * req.send(); * req.onreadystatechange = () => { * if (req.readyState === 4) { * window.location.href = "./relative-path"; * } * }; * ``` * * The redirected url will be "./__cypress/iframes/relative-path" instead of "http://localhost/relative-path". * The issue is when Cypress is resolving the relative path. This `shadow model` of XMLHttpRequest should fix this issue. */ export declare const createXMLHttpRequestProxy: (win: WindowTypeOfRequestProxy, requestProxy: RequestProxy) => void;