Repository navigation
fix(windows): send content headers with the request body - #11663
Merged
Merged
Conversation
|
View your CI Pipeline Execution ↗ for commit 2dbe6d0
💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗ ☁️ Nx Cloud last updated this comment at |
commit: |
Content-Type and the other content headers were appended to the message's headers, which WinRT refuses for them (the failure was swallowed), so a string body went out as HttpStringContent's default text/plain. A server that only parses JSON when it's labelled as JSON saw an empty body: a Colyseus joinOrCreate lost its options. Content headers now go on the body's headers once the body is set, replacing the content's default; Content-Length is left to WinRT.
triniwiz
force-pushed
the
fix/windows-http-content-headers
branch
from
November 21, 2026 23:20
8fbebfc to
2dbe6d0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Windows,
http.request, and sofetchandXMLHttpRequest, sent a string body astext/plain, whateverContent-Typethe caller set.The request headers were appended to
HttpRequestMessage.Headers. WinRT refuses content headers there (Content-Type,Content-Encodingand the like belong toHttpContent.Headers), and thetry/catchswallowed the failure.HttpStringContentthen went out with its defaulttext/plain; charset=UTF-8.Servers that only parse JSON when it's labelled as JSON saw an empty body. For example, a Colyseus
joinOrCreatelost its options: the player got a random name and the default look instead of the ones sent.Fix
Content headers are held back while the message headers are filled. Once the body is set, they're added to
requestMessage.Content.Headers, replacing the content's default.Content-Lengthis left to WinRT, which sets it from the body.Testing
Tested on Windows in a WinUI 3 game whose client joins a Colyseus room with
{ name, look }: