Setu-TS
    Preparing search index...

    Function ValidateBody

    • Attaches a request body schema to the decorated route handler.

      The schema is enforced (invalid bodies answered with 400) when a CAPABILITIES.VALIDATION provider is registered and enforceSchemas is not false; otherwise it remains description-only. See the module documentation.

      The first-party validation service requires application/json or an application/*+json media type; options.forms: true also accepts form types. An unsupported or absent type answers 415 before any body read. A replacement service owns its own media-type handling. Cookie-authenticated routes still need csrfMiddleware or csrfFormMiddleware; pair opted-in forms with the latter.

      Parameters

      • schema: unknown

        Validation schema (Zod schema by convention)

      • Optionaloptions: ValidationMiddlewareOptions

        forms: true also validates urlencoded and multipart bodies

      Returns SetuMethodDecorator

      A method decorator

      0.1.0