Skip to content

TestRequestInit

type TestRequestInit = unknown

Init options accepted by a test handle’s fetch(target, init).

The body is unknown and is JSON-serialized automatically unless already raw bytes; the integration harness assumes JSON for convenience, in contrast to the unit-level MockContextOpts.body which is raw bytes only.

Pass signal to test handlers that observe request cancellation via ctx.req.signal; aborting the signal mid-fetch propagates to the handler.

Learn: Write your first test

Last updated: