# All files / common/decorators/http http-code.decorator.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 2/2
100% Lines 5/5

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    151x

    1x
    1x
    1x
    1x

     import { HTTP_CODE_METADATA } from '../../constants';

    /**
     * Defines the HTTP response status code.
     * It overrides default status code for the given request method.
     *
     * @param  {number} statusCode
     */
    export function HttpCode(statusCode: number): MethodDecorator {
      return (target: object, key, descriptor) => {
        Reflect.defineMetadata(HTTP_CODE_METADATA, statusCode, descriptor.value);
        return descriptor;
      };
    }