BaseBodyParserFramework
@h4ad/serverless-adapter > BaseBodyParserFramework
(class) BaseBodyParserFramework
The base class used by other body-parser functions to parse a specific content-type
Signature:
export declare class BaseBodyParserFramework<TApp> implements FrameworkContract<TApp>
Implements: FrameworkContract <TApp>
(constructor)
Default Constructor
Signature:
protected constructor(framework: FrameworkContract<TApp>, middleware: NextHandleFunction, options?: BodyParserOptions | undefined);
Parameters
Parameter | Type | Description |
---|---|---|
framework | FrameworkContract <TApp> | |
middleware | NextHandleFunction | |
options | BodyParserOptions | undefined | (Optional) |
(method) defaultHandleOnError
The default function to handle errors
Signature:
protected defaultHandleOnError(_request: IncomingMessage, response: ServerResponse, error: HttpError<any>): void;
Parameters
Parameter | Type | Description |
---|---|---|
_request | IncomingMessage | The referecene for request |
response | ServerResponse | The reference for response |
error | HttpError<any> | The error throwed by body-parser |
Returns:
void
(property) errorHandler
The selected error handler
Signature:
protected readonly errorHandler: NonNullable<BodyParserOptions['customErrorHandler']>;
(property) framework
Signature:
protected readonly framework: FrameworkContract<TApp>;
(property) middleware
Signature:
protected readonly middleware: NextHandleFunction;
(method) onBodyParserFinished
Handle next execution called by the cors package
Signature:
protected onBodyParserFinished(app: TApp, request: IncomingMessage, response: ServerResponse): () => void;
Parameters
Parameter | Type | Description |
---|---|---|
app | TApp | |
request | IncomingMessage | |
response | ServerResponse |
Returns:
() => void
(property) options
Signature:
protected readonly options?: BodyParserOptions | undefined;
(method) sendRequest
Signature:
sendRequest(app: TApp, request: IncomingMessage, response: ServerResponse): void;
Parameters
Parameter | Type | Description |
---|---|---|
app | TApp | |
request | IncomingMessage | |
response | ServerResponse |
Returns:
void