ztjhz / BetterChatGPT

An amazing UI for OpenAI's ChatGPT (Website + Windows + MacOS + Linux)
http://bettergpt.chat/
Creative Commons Zero v1.0 Universal
7.8k stars 2.64k forks source link

Server-Sent-Events compliance: Allow space in front of value #509

Open Ruakij opened 6 months ago

Ruakij commented 6 months ago

According to the Spec for SSE, when a line contains a colon character, the first colon separates field and value.

A space in front of the value field is allowed, but not required.

[..] If value starts with a U+0020 SPACE character, remove it from value.

This Patch makes the regex-space optional to archive that.

If interested: I found this issue when i implemented the API and wanted to use it, but the web-library gin sends Server-Sent-Events without the space, thus not working at all.