-
Notifications
You must be signed in to change notification settings - Fork 38
Fix: preserve user-defined Content-Type in fetch responses #1844
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
base: main
Are you sure you want to change the base?
Fix: preserve user-defined Content-Type in fetch responses #1844
Conversation
sgammon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for the fix; please fix formatting and don't forget to rebase, as the null ConsoleIntrinsic bug had a fix merged
| if (!headers.has("Content-Type")) { | ||
| headers.set("Content-Type", "text/plain") | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plz fix formatting here
| if (!headers.has("Content-Type")) { | ||
| headers.set("Content-Type", "application/json") | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here too
| val serializedArgs = when { | ||
| args == null -> listOf("null") | ||
| else -> args.toList().filterNotNull() | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
args == null
and
else ->
should both be indented here
sgammon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, once the changes above are posted, I can approve
ffd0b1f to
c77e982
Compare
|
Hi, I’ve fixed the formatting and rebased onto the latest main as requested. |
This PR fixes an issue where FetchResponse overwrote user-defined Content-Type headers.
Before, mapResponseBody() always replaced Content-Type based on body type.
After, ensures Content-Type is only set when not already provided.
Fixes #1817