How to use Nest.js’s @Headers properly?

Headers will be sent in lower case so you need @Headers('my-id') instead.


Easy to debug by injecting the full headers object:

import { Headers } from '@nestjs/common';
...
@Put("https://stackoverflow.com/")
public async put(@Headers() headers) {
    console.log(headers);
}

The headers variable will then refer to the req.headers.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)