# All files / common/decorators/http header.decorator.ts

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

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    131x
    1x

    1x
    2x
    2x
    2x

     import { HEADERS_METADATA } from '../../constants';
    import { extendArrayMetadata } from '../../utils/extend-metadata.util';

    /**
     * Sets a response header.
     */
    export function Header(name: string, value: string): MethodDecorator {
      return (target: object, key, descriptor) => {
        extendArrayMetadata(HEADERS_METADATA, [{ name, value }], descriptor.value);
        return descriptor;
      };
    }