UNPKG

954 BTypeScriptView Raw
1/// <reference types="express" />
2import { Context } from '@loopback/core';
3import { OperationObject } from '@loopback/openapi-v3';
4import { Request } from '../types';
5import { BodyParser, RequestBody } from './types';
6export declare class RequestBodyParser {
7 private readonly ctx?;
8 readonly parsers: BodyParser[];
9 constructor(parsers?: BodyParser[], ctx?: Context | undefined);
10 loadRequestBodyIfNeeded(operationSpec: OperationObject, request: Request): Promise<RequestBody>;
11 /**
12 * Match the http request to a given media type of the request body spec
13 */
14 private _matchRequestBodySpec;
15 /**
16 * Find a body parser that supports the media type
17 * @param matchedMediaType - Media type
18 */
19 private _findParser;
20 /**
21 * Resolve and invoke a custom parser
22 * @param customParser - The parser name, class or function
23 * @param request - Http request
24 */
25 private _invokeCustomParser;
26}