Skip to content

replaceRequest

replaceRequest(context, value): void

Defined in: packages/pipeline/src/helpers/replace-request.ts:22

Hands the handler value in place of its input, for a behavior that produces a new value instead of changing the caller’s object, such as a validated, parsed copy. For a wrapped function that takes several arguments, value is the new argument array. Later behaviors see the replacement as context.request.

IPipelineContext

unknown

void

TypeError when the context does not support replacement, or when a multi-argument call receives a value that is not an array.

async handle(context: IPipelineContext, next: NextDelegate) {
replaceRequest(context, schema.parse(context.request));
return next();
}