Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: only send exception responses if header is not already sent #8802

Merged

Conversation

wSedlacek
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

When an exception is thrown it will trigger the exception filter to try to send a reply.
If a header was already sent then the exception filter will fail to send this reply.

Does this PR introduce a breaking change?

  • Yes
  • No

This change requires adapters to provide two new methods, isHeaderSent() and end()

Other information

@coveralls
Copy link

coveralls commented Dec 17, 2021

Pull Request Test Coverage Report for Build 76e79d94-3655-4331-aa6d-cef51bdcc711

  • 6 of 8 (75.0%) changed or added relevant lines in 1 file are covered.
  • 33 unchanged lines in 9 files lost coverage.
  • Overall coverage decreased (-0.1%) to 94.053%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/core/exceptions/base-exception-filter.ts 6 8 75.0%
Files with Coverage Reduction New Missed Lines %
packages/common/utils/is-uuid.ts 1 83.33%
packages/core/injector/module-token-factory.ts 1 94.29%
packages/core/router/sse-stream.ts 1 92.59%
packages/common/file-stream/streamable-file.ts 2 76.19%
packages/microservices/server/server-mqtt.ts 2 84.5%
packages/core/helpers/messages.ts 3 77.27%
packages/core/router/route-path-factory.ts 4 90.59%
packages/microservices/client/client-nats.ts 5 87.41%
packages/core/scanner.ts 14 89.45%
Totals Coverage Status
Change from base Build 2402d944-a9de-4ca1-82ac-e447b189c311: -0.1%
Covered Lines: 5662
Relevant Lines: 6020

💛 - Coveralls

Co-authored-by: Micael Levi L. Cavalcante <mllc@icomp.ufam.edu.br>
Co-authored-by: Micael Levi L. Cavalcante <mllc@icomp.ufam.edu.br>
@kamilmysliwiec kamilmysliwiec changed the base branch from master to 9.0.0 June 20, 2022 13:00
@kamilmysliwiec kamilmysliwiec merged commit e091cd5 into nestjs:9.0.0 Jun 20, 2022
@kamilmysliwiec kamilmysliwiec mentioned this pull request Jun 20, 2022
12 tasks
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.

None yet

4 participants