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: support parsing buffers #13

Merged
merged 1 commit into from
Jan 11, 2021
Merged

Conversation

jkirkpatrick24
Copy link
Contributor

Checklist

Summary

When parse is called with a Buffer, an error was being thrown because we were attempting to call text.charCodeAt which doesn't exist for buffers. This simply adds a check if charCodeAt exists before attempting to invoke it.

@mcollina
Copy link
Member

mcollina commented Jan 9, 2021

charCodeAt is needed in that place. We should convert to string before parsing.

@kibertoad
Copy link
Member

kibertoad commented Jan 9, 2021

@mcollina Probably it's not ideal that no tests are failing despite that operation being needed. Should we add a test with Buffer that includes BOM in it?

@jkirkpatrick24
Copy link
Contributor Author

Thanks for reviewing! Updated and added an extra test.

Copy link
Member

@L2jLiga L2jLiga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit 5b343f7 into fastify:master Jan 11, 2021
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.

4 participants