Skip to main content
fetch(_req): Promise<Response>
Optional HTTP-style entry. stub.fetch(req) from a caller routes here. Subclasses override; the base default returns 404. Request and Response are the standard Fetch API globals (Node 18+ exposes both natively). The returned body is delivered to the caller once it is complete. It must complete within the call’s time budget — which covers the handler and its body together, with a short grace period for the body when the handler finishes near the limit — and within a 32 MiB size limit; otherwise the call fails. Exception: an unencoded text/event-stream body. The frames available when the handler returns (or shortly after) are delivered and the stream is then cancelled; the delivered body ends at the last complete event and any Content-Length you set is removed. An EventSource reconnects (its reconnect delay is set to about one second), so the stream must be able to resume from Last-Event-ID or from its own state. Parameters Returns Promise<Response> Inherited from StatefulActor.fetch