Skip to main content
BlazeRequest wraps the standard Web Platform Request and adds everything you need to build a Cloudflare Workers API: typed env bindings, the ExecutionContext, route parameters, query helpers, cached body parsers, and CF-specific metadata. Blaze constructs one BlazeRequest instance per incoming request inside app.fetch and passes it through the entire middleware chain by reference — so any property you attach in one middleware is visible in every subsequent handler.

Cloudflare-native properties

These properties give you direct, type-safe access to your Workers bindings and routing context.

Body helpers

Blaze reads the raw request body once into an internal ArrayBuffer cache. Every body helper below re-uses that cache, so you can safely call req.json() or req.text() multiple times within the same request — including from different middleware functions — without draining the stream.
req.json() caches the raw ArrayBuffer, then decodes and parses it on each call. If you need to pass the body to another function that expects a stream, use req.arrayBuffer() instead and construct the stream yourself.

Metadata helpers

Use these to inspect the client, content type, and request headers without reaching into the raw Headers object.

TypeScript augmentation

Middleware often attaches custom properties to req (e.g. req.user from an auth middleware, req.id from a request-ID middleware). Declare these additions by augmenting the BlazeRequest interface in a .d.ts file — TypeScript will then infer them everywhere req appears.
types/blaze.d.ts
middleware/auth.ts

Complete handler example

This example uses several req properties together to demonstrate a realistic route: