TypedHeaders is a decorator function that can parse HTTP headers. It is almost
same with nest.Headers, but it can automatically cast property type following
its DTO definition. Also, TypedHeaders performs type validation.
For reference, target type T must follow such restrictions. Also, if actual HTTP
header values are different with their promised type T, BadRequestException
error (status code: 400) would be thrown.
Type T must be an object type
Do not allow dynamic property
Property key must be lower case
Property value cannot be null, but undefined is possible
Only boolean, bigint, number, string or their array types are allowed
Type safe HTTP headers decorator.
TypedHeadersis a decorator function that can parse HTTP headers. It is almost same with nest.Headers, but it can automatically cast property type following its DTO definition. Also,TypedHeadersperforms type validation.For reference, target type
Tmust follow such restrictions. Also, if actual HTTP header values are different with their promised typeT,BadRequestExceptionerror (status code: 400) would be thrown.Tmust be an object typenull, butundefinedis possibleboolean,bigint,number,stringor their array types are allowedset-cookiemust be array type