Closed ymchun closed 5 years ago
I have the same problem after updating to 5.7.0. The same code works fine in version 5.6.2.
Maybe I'm doing something wrong, this is my code:
@Get(':id')
async findOne(@Param('id') id, @Query() query, @Res() res) {
const out = await this.invoiceService.findOne(id, query);
if ('pdf' in query){
res.setHeader('Content-Type', 'application/pdf');
}
res.send(out);
}
Depending on the query i'm sending a json or a binary. That code was working fine in 5.6.2, but in 5.7.0 my service is not being called.
@kamilmysliwiec the doc said if both approaches are used at the same time, @Res()
approach will be used. But why the handler not called ?
And I follow https://docs.nestjs.com/controllers Library-specific approach example, still not working.
Could you share a small repository which reproduces your issue?
During making the example code, it works after I removed all interceptors.
And I saw this https://docs.nestjs.com/interceptors
WARNING
The response mapping feature doesn't work with the library-specific response strategy (using the @Res() object directly is forbidden).
So, I think the root cause is interceptor didn't support library-specific response strategy, is there any way to skip global interceptors when using @Res()
?
Why v5.6.2
global interceptor with @Res()
works but v5.7.9
doesn't work?
Should be fixed in v5.7.1
.
@kamilmysliwiec thank you very much 🥳
This problem occurs again in the latest version of nestjs (6.0.1). I think it's the same problem, if I disable the interceptors It works again.
It was fixed here: https://github.com/nestjs/nest/issues/1738
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
I'm submitting a...
Current behavior
When any endpoints which injected the response object using
@Res()
decorator, the handler didn't called at all. From the following code example, the console has nothing printed out.Expected behavior
The handler should be called and the console should print out
debug
Minimal reproduction of the problem with instructions
👆👆👆👆👆 this doesn't work 👆👆👆👆👆
👇👇👇👇👇 this works 👇👇👇👇👇
Environment