Add space between SSE field and value for compatibility #2149
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
according to https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation using
field: value
style is OK.Motivation
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
in this case, axum powered http server responsed sse event will not be correctly parsed by theses libs,
and they can not receive any message from axum powered sse server.
Solution
add a U+0020 SPACE character, between
field
andvalue
Related
openai/openai-python#559
openai/openai-python#502
#2146