GitHub

HttpApiMiddleware

API reference for HttpApiMiddleware.

A middleware tag providing P to the handlers, failing with E (encoded by error: a schema, or a tuple of them, each sent with its own status; an S.Union is one schema, sent with the union's status, 500 by default) and needing R. The class keyword security makes it a security middleware; required_for_client makes a client of its endpoints use its client layer (layer_client).

Attributes

AttributeTypeDescription
errorCodec[E_co, Any, Never, Never] | tuple[Codec[E_co, Any, Never, Never], ...] = ()
securityMapping[str, HttpApiSecurity] | None = None
required_for_clientbool = False

Functions

errors

errors() -> tuple[Top, ...]

The error schemas, as a tuple.

Returns tuple[Top, ...]

@classmethod
def errors(cls) -> tuple[Top, ...]:
    """The error schemas, as a tuple."""
    error = cls.error
    return error if isinstance(error, tuple) else (error,)