Skip to main content

Function: encodeRequest()

encodeRequest(request, encodeHeaders?, encodeBody?): Promise<any>

Defined in: web-api-encoding.ts:143

Encode Request object to an intermediate form that can be stringified to JSON

Note: This consumes the request body. If you need the original Request after encoding, clone it before calling this function: request.clone()

Why callbacks? Users can safely ignore the optional encodeHeaders and encodeBody callbacks. They are used internally to enable cycle/alias tracking when this object is embedded in another object.

Parameters

request

Request

The Request to encode

encodeHeaders?

(h) => any

Optional callback to encode Headers (default: inline encoding)

encodeBody?

(b) => any

Optional callback to encode body (default: inline encoding)

Returns

Promise<any>