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

Check if body is set before writing to response #317

Merged
merged 2 commits into from
Jul 22, 2023
Merged

Conversation

dukeofharen
Copy link
Owner

@dukeofharen dukeofharen commented Jul 22, 2023

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

An exception is thrown when using the reverse proxy response writer and the called server returns an HTTP 204. An empty body is written to the response, which is not allowed by .NET, which results in an exception.

What is the new behavior?

At first, a check was done that the returned response is not null before writing the stub response. Since an empty body is not null, the empty body was written and an exception was thrown. Now, we also check whether the body has contents before writing it to the response.

Does this introduce a breaking change?

  • Yes
  • No

@dukeofharen dukeofharen merged commit 709f5e8 into master Jul 22, 2023
@dukeofharen dukeofharen deleted the bug/proxy-bug branch July 22, 2023 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant