Skip to content

fix(microservices): preserve packet headers in nats serializer#16675

Merged
kamilmysliwiec merged 1 commit into
nestjs:masterfrom
wwenrr:fix/issue-10273-nats-response-headers
Apr 3, 2026
Merged

fix(microservices): preserve packet headers in nats serializer#16675
kamilmysliwiec merged 1 commit into
nestjs:masterfrom
wwenrr:fix/issue-10273-nats-response-headers

Conversation

@wwenrr

@wwenrr wwenrr commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Preserve packet.headers when a NATS response payload is a plain value/object instead of a NatsRecord.

Changes

  • Updated NatsRecordSerializer.serialize() to carry packet.headers into the fallback NatsRecordBuilder path.
  • Added serializer test coverage for the non-NatsRecord path with explicit NATS headers.

Manual test / verification

  • Ran targeted test suite:
    • npx mocha packages/microservices/test/serializers/nats-record.serializer.spec.ts
  • Verified the new test applies packet headers when data is not a NatsRecord passes.
  • Existing serializer tests continue passing.

Fixes #10273

@coveralls

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 72fdba91-cd08-4a5f-936b-29f58a5dbd3e

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 89.856%

Totals Coverage Status
Change from base Build bcb7b573-9798-42cb-a347-1d1f9e70592c: 0.0%
Covered Lines: 7600
Relevant Lines: 8458

💛 - Coveralls

@kamilmysliwiec kamilmysliwiec merged commit 4a48ea5 into nestjs:master Apr 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

I'm not able to set headers for NATS response

3 participants