Stone.js API
    Preparing search index...

    Function declareResponseStatus

    • Record, on the class, the status the decorated method answers with.

      The decorator already knows it: the author wrote @JsonHttpResponse(201) once. Without this the knowledge lived only inside the wrapped function, so anything reading the class, a generated contract above all, had to assume 200 and contradicted the code it was derived from.

      Declaring it changes nothing at run time. It is what makes "the code is the single description" true for the status as well as for the payload.

      Parameters

      • context: ClassMethodDecoratorContext

        The method decorator context.

      • statusCode: number

        The status the method answers with.

      Returns void