Skip to content

Commit

Permalink
docs(bypass): clarify accept request header usage
Browse files Browse the repository at this point in the history
  • Loading branch information
kettanaito committed Nov 10, 2024
1 parent 17841a7 commit 43ae6fa
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/core/bypass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ export function bypass(input: BypassRequestInput, init?: RequestInit): Request {

const requestClone = request.clone()

// Set the internal header that would instruct MSW
// to bypass this request from any further request matching.
// Unlike "passthrough()", bypass is meant for performing
// additional requests within pending request resolution.

/**
* Send the internal request header that would instruct MSW
* to perform this request as-is, ignoring any matching handlers.
* @note Use the `accept` header to support scenarios when the
* request cannot have headers (e.g. `sendBeacon` requests).
*/
requestClone.headers.append('accept', 'msw/passthrough')

return requestClone
Expand Down

0 comments on commit 43ae6fa

Please sign in to comment.