Skip to main content

NetworkContract

@h4ad/serverless-adapter > NetworkContract

(interface) NetworkContract

Creates HTTP request/response objects and extracts the collected response data.

Signature:

export interface NetworkContract<TRequest extends IncomingMessage = NetworkRequest, TResponse extends ServerResponse = NetworkResponse> 

(property) createRequest

Create the request that will be forwarded to the framework.

Signature:

createRequest: (props: NetworkRequestProps) => TRequest;

(property) createResponse

Create the response that will receive framework output.

Signature:

createResponse: (props: NetworkResponseProps) => TResponse;

(property) getResponseBody

Extract the response body collected by the response implementation.

Signature:

getResponseBody: (response: TResponse) => Buffer;

(property) getResponseHeaders

Extract the response headers collected by the response implementation.

Signature:

getResponseHeaders: (response: TResponse) => BothValueHeaders;