Skip to main content

readOperationBody

@webda/core


Function: readOperationBody()

readOperationBody(context, operationId): Promise<any>

Defined in: packages/core/src/core/operations.ts:702

Read the request body the way an operation receives it: HTML-sanitized, except for the texts its input schema gives another mode (@sanitize none, html or markdown)

The body is parsed once per context: the object returned here is the one callOperation validates, hands to the authorizers and passes to the operation, and the one context.getInput() returns from then on. Code that needs to change the body before calling the operation (a transport injecting a value) must read it with this function: a body read with context.getInput() beforehand is read again when the operation declares modes.

Parameters​

context​

OperationContext

the execution context

operationId​

string

the operation identifier

Returns​

Promise<any>

the body, undefined when there is none