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

fix(sse): stream sink content #9000

Merged

Conversation

thiagomini
Copy link
Contributor

@thiagomini thiagomini commented Jan 21, 2022

closes #8877

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

When using SSE feature, the first message received by client contains only colons (":").

Issue Number: #8877

What is the new behavior?

When using SSE feature, the first message received by client contains only newline character ("\n").

Does this PR introduce a breaking change?

  • Yes
  • No

N/A

Other information

I chose to keep the newline character as suggested by @jpineaufr. I think it was added to pretty print the message. Also, we could improve tests readability with some utility functions to encapsulate parts of the code and make use of "give", "when" and "then", like so:

const { sse, sink } = givenANewSseWithSink()
   
whenMessageIs({
  type: 'tea-time',
  id: 'the-id',
  retry: 222,
  data: 'hello',
})

await written(sink);

expect(sink.content).to.equal(
 `
event: tea-time
id: the-id
retry: 222
data: hello

`,
    );

@thiagomini thiagomini force-pushed the hotfix/sse-stream-sink-content branch from 26333c7 to 3dafe28 Compare January 21, 2022 19:04
@coveralls
Copy link

Pull Request Test Coverage Report for Build a7ff8fd1-6101-4690-8fb1-cb33639e2040

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 94.13%

Totals Coverage Status
Change from base Build d20b4d97-8bfd-440c-9b6c-e33520cb182a: 0.0%
Covered Lines: 5693
Relevant Lines: 6048

💛 - Coveralls

@kamilmysliwiec
Copy link
Member

Thanks @thiagomini, I'll review it shortly

@MarkPieszak
Copy link
Member

LGTM 👍

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.

SSE: first message contains only colons
4 participants