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: setting any content header (specifically) after setting JSON body resets HttpContent to empty #99

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

skwasjer
Copy link
Owner

When setting any content header after setting the HttpContent with the .JsonBody()-extension (or any other custom IResponseBehavior) it would reset the HttpContent to an empty content, undoing the user added content.

Fixed by preemptively setting the HttpResponseMessage.Content to an empty content before any user registered behaviors run, instead of checking for a specific behavior type. This was brittle because it depended on a specific implementation type check which the JsonContentBehavior did not satisfy.

Fixes #98

…th JsonBody (or any other custom IResponseBehavior) it would reset the HttpContent to an empty content.
Copy link

@skwasjer skwasjer merged commit cf3f387 into main Jan 31, 2024
12 checks passed
@skwasjer skwasjer deleted the bugfix/issue98 branch January 31, 2024 12:06
@skwasjer skwasjer added the bug Something isn't working label Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting headers on response cancels the body
1 participant