Skip to content
module@warp-drive/core/request

Interface Context

Defined in: warp-drive-packages/core/src/request/-private/context.ts:167

The context object given to each Handler (or CacheHandler) as it processes a request. It exposes the (immutable, enhanced) request along with the methods a handler uses to build up the Future and StructuredDataDocument that will ultimately be returned by the RequestManager.

Methods

setIdentifier()

ts
setIdentifier(identifier): void;

Defined in: warp-drive-packages/core/src/request/-private/context.ts:223

Associate a RequestKey with this request. May only be called synchronously from a CacheHandler.

Parameters

identifier

RequestKey

Returns

void


setResponse()

ts
setResponse(response): void;

Defined in: warp-drive-packages/core/src/request/-private/context.ts:213

Set the ResponseInfo (or raw Response) associated with this request. Used to populate the response information available on the resulting StructuredDataDocument.

Parameters

response

| Response | ResponseInfo | null

Returns

void


setStream()

ts
setStream(stream): void;

Defined in: warp-drive-packages/core/src/request/-private/context.ts:203

Set the response stream for this request. May be called at most once, and may be called at any point up until the handler's request method resolves.

Parameters

stream

| ReadableStream<any> | Promise< | ReadableStream<any> | null>

Returns

void

Properties

id

ts
id: number;

Defined in: warp-drive-packages/core/src/request/-private/context.ts:183

The id of this request as assigned by the RequestManager. Not unique across manager instances.


request

ts
request: ImmutableRequestInfo;

Defined in: warp-drive-packages/core/src/request/-private/context.ts:176

A readonly, immutable version of the request being handled, including any defaults or enhancements applied by the RequestManager.

hasRequestedStream

Get Signature

ts
get hasRequestedStream(): boolean;

Defined in: warp-drive-packages/core/src/request/-private/context.ts:238

Whether the application (or a downstream handler) has requested access to the response stream via Future.getStream. Handlers can use this to avoid the cost of streaming when nothing will consume it.

Returns

boolean

Released under the MIT License.