Skip to content

[HttpClient] Add ServerSentEvent::getArrayData() to get the SSE's data decoded as an array directly #49798

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

Merged
merged 1 commit into from
Mar 30, 2023

Conversation

fancyweb
Copy link
Contributor

Q A
Branch? 6.3
Bug fix? no
New feature? yes
Deprecations? no
Tickets -
License MIT
Doc PR -

Although the data field in SSEs can be "anything", it's really common that it's a JSON payload.

Just like we have a shortcut in responses (ResponseInterface::toArray()), I think it's worth having a shortcut in ServerSentEvent to avoid writing boilerplate code again and again 😅

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just minor things.

@fancyweb fancyweb force-pushed the http-client/sse-get-array-data branch from b162761 to 042aa02 Compare March 29, 2023 07:14
@fancyweb fancyweb force-pushed the http-client/sse-get-array-data branch from 042aa02 to cdbf939 Compare March 29, 2023 07:32
@nicolas-grekas
Copy link
Member

Thank you @fancyweb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants