Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Feature request: set HttpCode trough res.status() #1869
I'm submitting a...
Currently the only way to set a custom http status code is to use the
Wouldn't it be nice to be able to use the
Right now we could do something like this, but this doesn't feel like a good solution since the response will be sent and other interceptors won't have effect anymore.
@kamilmysliwiec the only thing that I’m looking at is to make it so that we could set it by using reflect meta. I tried to set it but this doesn’t work because NestJS is running the interceptors after it received the status code.
Could we just switch this process without breaking changes?
So, first transform the data (run the interceptors etc) then pull the httpstatus code using the reflect metadata key?
So I think that we could check whether
@kamilmysliwiec wouldn't it be better to just make sure nest sets the
But I think this will just complicate things more. The best solution is to set the statusCode on the response before we run the interceptors, this way you can also get the statusCode inside your interceptor if needed and we don't have to care about handling the status override on the end.