Interface for a body parser.

interface BodyParserInterface {
    attachTo?: (app: ZibriApplication) => void | Promise<void>;
    contentType: MimeType;
    parse: (
        req: HttpRequest | WebsocketRequest,
        bodyMetadata: BodyMetadata,
    ) => Promise<unknown>;
}

Implemented by

Properties

attachTo?: (app: ZibriApplication) => void | Promise<void>

Attaches the body parser to the Zibri application.

contentType: MimeType

The content type that can be handled by this parser.

parse: (
    req: HttpRequest | WebsocketRequest,
    bodyMetadata: BodyMetadata,
) => Promise<unknown>

Parses the body of the http request.