Skip to content

fix: setting any content header (specifically) after setting JSON body resets HttpContent to empty#99

Merged
skwasjer merged 1 commit intomainfrom
bugfix/issue98
Jan 31, 2024
Merged

fix: setting any content header (specifically) after setting JSON body resets HttpContent to empty#99
skwasjer merged 1 commit intomainfrom
bugfix/issue98

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.
@sonarqubecloud
Copy link

@skwasjer skwasjer merged commit cf3f387 into main Jan 31, 2024
@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