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 JSON body with multibyte strings. #34

Merged
merged 2 commits into from
Jan 29, 2024
Merged

Conversation

hunkydoryrepair
Copy link
Contributor

Added new test "multibyte character body" which would fail as it was.

_rawbody gets send to the data handler of the express raw-data handler, which validates the data.length is equal to the content-length header. Converting the data to a string changes the length from bytes to characters, so this failed every time with multibyte characters.

Set _rawBody to retain the length in bytes (it remains a buffer), and it converted to string only when body getter is called.

_bodydata seems to only be used if something externally sets it via the body setter, so I did not want to change that.

(also fixed axios version to 1.4 so the userAgent test would pass).

@hunkydoryrepair
Copy link
Contributor Author

I'm not sure what Node 20 is failing...looks like Axios is completely broken and I doubt related to my changes

@endel endel merged commit e1080a3 into colyseus:master Jan 29, 2024
1 of 2 checks passed
@endel
Copy link
Member

endel commented Jan 29, 2024

Thank you for the PR @hunkydoryrepair 🙏 Just released new version with your fix

Strange that Node v20 is failing indeed - I'm afraid it's related to uWebSockets.js binaries for that version. I'll investigate this a bit later as the examples under examples folder all seem to be working fine

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.

None yet

2 participants