Reputation: 161
I'm trying to set a custom reponse header in a nest js controller and using fastify.
Currently I'm trying to do:
@Post()
async methodName(@Res res){
res.set('key', 'value');
};
But I get the error: res.set is not a function
Can someone help me?
Upvotes: 6
Views: 7443
Reputation: 70412
If you are needing to set a static header value as well, you can always use the @Header()
decorator on the route handler so you could have
@Post()
@Header('key', 'value')
async method() {
return something;
}
Upvotes: 2