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

Ability to not JSON.stringify simple strings #22

Open
Bo98 opened this issue Nov 2, 2019 · 1 comment · May be fixed by #35
Open

Ability to not JSON.stringify simple strings #22

Bo98 opened this issue Nov 2, 2019 · 1 comment · May be fixed by #35
Assignees

Comments

@Bo98
Copy link

Bo98 commented Nov 2, 2019

For simple strings like sse.send("Test string"), you get the following output:

id: 0
data: "Test string"

However it is perfectly valid to have, and perhaps more common to have:

id: 0
data: Test string

If this representation is desired however, it is not possible to get it currently using express-sse.

@dpskvn dpskvn self-assigned this Nov 6, 2019
@ekoeryanto
Copy link

I think that's simple to do.

const stringify = (val) => typeof val === 'string' ? val : JSON.stringify(val)

Ah, just do it with PR

ekoeryanto added a commit to ekoeryanto/express-sse that referenced this issue Oct 7, 2020
@ekoeryanto ekoeryanto linked a pull request Oct 7, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants