@adonisjs/bodyparser
Version:
BodyParser middleware for AdonisJS http server to read and parse request body
32 lines (31 loc) • 1.1 kB
TypeScript
import type { HttpContext } from '@adonisjs/http-server';
import type { NextFn } from '@poppinss/middleware/types';
import type { FeatureFlags } from '@adonisjs/application';
import type { ExperimentalFlagsList } from '@adonisjs/application/types';
import type { BodyParserConfig } from './types.ts';
/**
* Bindings to extend request
*/
import './bindings/request.ts';
/**
* BodyParser middleware parses the incoming request body and sets it as
* request body to be read later in the request lifecycle.
*/
export declare class BodyParserMiddleware {
#private;
/**
* Creates a new BodyParserMiddleware instance
*
* @param config - The body parser configuration
* @param _featureFlags - Feature flags (unused)
*/
constructor(config: BodyParserConfig, _featureFlags?: FeatureFlags<ExperimentalFlagsList>);
/**
* Handle HTTP request body by parsing it according to the user
* configuration
*
* @param ctx - The HTTP context
* @param next - The next middleware function
*/
handle(ctx: HttpContext, next: NextFn): Promise<any>;
}