rest-vir - v2.2.0
    Preparing search index...

    Type Alias BaseEndpointMethodDefinition<Method>

    type BaseEndpointMethodDefinition<
        Method extends DefinableHttpMethod = DefinableHttpMethod,
    > = {
        requestData?: Method extends HttpMethodsWithBodies
            ? Shape
            | undefined
            : never;
        requiredRequestHeaders?: Record<string, Shape | RegExp>;
        responses: ResponseDefinitions;
    }

    Type Parameters

    Index

    Properties

    requestData?: Method extends HttpMethodsWithBodies ? Shape | undefined : never
    • Omit to disable checking entirely.
    • Set to undefined to require no request data.
    • Set to a shape to enforce JSON shape validation.

    This is ignored entirely for http methods that do not allow request bodies.

    requiredRequestHeaders?: Record<string, Shape | RegExp>

    Headers that are required to be sent with requests to this endpoint.

    • Omit or set to undefined to disable required headers (assigning arbitrary headers is still allowed).

    • Set to an object to enforce headers for the given keys.

      • Set a key's value to a shape shape to enforce shape validation on that header's value.
      • Set a key's value to a RegExp to require each stringified value to match the given RegExp.

    Note that header values are always converted to strings.