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

v0.6.x chore(sse): add space between field and value for compatibility #2148

Closed
wants to merge 1 commit into from

Conversation

ttys3
Copy link
Contributor

@ttys3 ttys3 commented Aug 4, 2023

backport #2149

@ttys3 ttys3 changed the title chore(sse): add space between event name and value for compatibility v0.6.x chore(sse): add space between event name and value for compatibility Aug 4, 2023
@ttys3 ttys3 changed the title v0.6.x chore(sse): add space between event name and value for compatibility v0.6.x chore(sse): add space between field and value for compatibility Aug 4, 2023
according to https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation
using `field: value` style is OK.

> Collect the characters on the line after the first U+003A COLON character (:), and let value be that string. If value starts with a U+0020 SPACE character, remove it from value.

other client side tools may detect the `data` field rely on the space,

like this one https://github.com/openai/openai-python/blob/b82a3f7e4c462a8a10fa445193301a3cefef9a4a/openai/api_requestor.py#L106

and this one: https://github.com/sashabaranov/go-openai/blob/71a24931dbc5b7029901ff963dc4d0d2509aa7ed/stream_reader.go#L14
@davidpdrsn
Copy link
Member

I'll just cherry-pick #2149 when its merged.

@davidpdrsn davidpdrsn closed this Sep 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