Files
Shifted/node_modules/msw/lib/core/bypass.mjs
2026-02-10 01:14:19 +00:00

22 lines
722 B
JavaScript

import { invariant } from "outvariant";
function bypass(input, init) {
const request = new Request(
// If given a Request instance, clone it not to exhaust
// the original request's body.
input instanceof Request ? input.clone() : input,
init
);
invariant(
!request.bodyUsed,
'Failed to create a bypassed request to "%s %s": given request instance already has its body read. Make sure to clone the intercepted request if you wish to read its body before bypassing it.',
request.method,
request.url
);
const requestClone = request.clone();
requestClone.headers.append("accept", "msw/passthrough");
return requestClone;
}
export {
bypass
};
//# sourceMappingURL=bypass.mjs.map