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

Add condition when parse to json #33

Closed
wants to merge 2 commits into from
Closed

Add condition when parse to json #33

wants to merge 2 commits into from

Conversation

h-sw
Copy link

@h-sw h-sw commented Jan 26, 2022

Thanks to your open source, it was very helpful.

when request through nginx, request message is object but buffer. i fixed it

@@ -81,7 +81,7 @@ const onconnection = conn => {
closed = true
})
conn.on('message', /** @param {object} message */ message => {
if (typeof message === 'string') {
if (typeof message === 'string' || Buffer.isBuffer(message)) {
Copy link
Member

Choose a reason for hiding this comment

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

Don't we have to convert the buffer to a string first?

Maybe we should just add this:

if (Buffer.isBuffer(message)) {
  message = message.toString()
}

@dmonad
Copy link
Member

dmonad commented Nov 16, 2023

This is now implemented in #58

@dmonad dmonad closed this Nov 16, 2023
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.

2 participants