-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Open
Description
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
I want to send back from my method decorated with MessagePattern/EventPattern data with NATS headers and turns out that they're not passed in any way.
I tried with setting
@MessagePattern('abc')
method(@Ctx() context: NatsContext) {
ctx.getHeaders().set('response-header', 'abc')
return 'my data';
}with hope that they will be applied but with no luck - they're undefined 😂
Minimum reproduction code
https://github.com/Dzixxx/nestjs-typescript-starter-we4m7w
Steps to reproduce
No response
Expected behavior
I would expect that @Ctx() context: NatsContext will have method setResponseHeader and in ServerNats.getPublisher method it will apply them to packet and default serializer will handle it:
// line 26 of nats-record.serializer.ts
: new NatsRecordBuilder(packet?.data).build()
// new line 26 of nats-record.serializer.ts
: new NatsRecordBuilder(packet?.data).setHeaders(packet?.headers).build()
I'm open for any solution and even preparing PR (but I will need some help with preparing the solution)
Dziczek 😉
Package
- I don't know. Or some 3rd-party package
-
@nestjs/common -
@nestjs/core -
@nestjs/microservices -
@nestjs/platform-express -
@nestjs/platform-fastify -
@nestjs/platform-socket.io -
@nestjs/platform-ws -
@nestjs/testing -
@nestjs/websockets - Other (see below)
Other package
No response
NestJS version
9
Packages versions
Node.js version
16
In which operating systems have you tested?
- macOS
- Windows
- Linux
Other
No response
micalevisk
Metadata
Metadata
Assignees
Labels
No labels