alexandrevicenzi / go-sse

Server-Sent Events for Go
MIT License
172 stars 40 forks source link

Fix use of fmt.Fprintf when writing messages #21

Closed wdscxsj closed 4 years ago

wdscxsj commented 4 years ago

On line 95 of sse.go, fmt.Fprintf should be fmt.Fprint to properly handle messages containing % characters.

This PR also refactors the message serialization part to save a []byte/string conversion, with a test added.

alexandrevicenzi commented 4 years ago

Thanks

wdscxsj commented 4 years ago

@alexandrevicenzi This % issue is quite worth a new release, I guess? Before the fix, almost all % characters will result in format errors like %!d(MISSING).

alexandrevicenzi commented 4 years ago

You could use it from master, but I'll try to create a new tag/release this week.

alexandrevicenzi commented 4 years ago

Sorry for the delay, the new tag is available.