You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there an existing issue that is already proposing this?
I have searched the existing issues
Is your feature request related to a problem? Please describe it
I'm trying to attach a 'Last-Modified' header on my API response and was initially trying to use this code:
@Header('Last-Modified',newDate().toUTCString())
Unfortunatelly this doesn't work as expected, as the value for the header is only evaluated once at startup and thus it is the same value on every request.
Describe the solution you'd like
Would be great if we could pass a function to the value argument of the @Header decorator that is evaluated on every request to the given endpoint so we can have dynamic values for the header.
What is the motivation / use case for changing the behavior?
I have currently moved on to using an injected response object (using @Res decorator) and setting the header directly on it which is all fine, but it is not really nice to have additional native response handling code when only a simple header is needed and thus the nest.js way would be much more elegant.
The text was updated successfully, but these errors were encountered:
Is there an existing issue that is already proposing this?
Is your feature request related to a problem? Please describe it
I'm trying to attach a 'Last-Modified' header on my API response and was initially trying to use this code:
Unfortunatelly this doesn't work as expected, as the value for the header is only evaluated once at startup and thus it is the same value on every request.
Describe the solution you'd like
Would be great if we could pass a function to the value argument of the
@Header
decorator that is evaluated on every request to the given endpoint so we can have dynamic values for the header.Teachability, documentation, adoption, migration strategy
Use a function for the value argument on the
@Header
decorator to evaluate an expression on every request:What is the motivation / use case for changing the behavior?
I have currently moved on to using an injected response object (using
@Res
decorator) and setting the header directly on it which is all fine, but it is not really nice to have additional native response handling code when only a simple header is needed and thus the nest.js way would be much more elegant.The text was updated successfully, but these errors were encountered: