express-sse icon indicating copy to clipboard operation
express-sse copied to clipboard

Ability to not JSON.stringify simple strings

Open Bo98 opened this issue 5 years ago • 1 comments

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.

Bo98 avatar Nov 02 '19 23:11 Bo98

I think that's simple to do.

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

Ah, just do it with PR

ekoeryanto avatar Oct 07 '20 04:10 ekoeryanto