-
Notifications
You must be signed in to change notification settings - Fork 2
fix: handle errors which occur prior to stream initiation #57
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
Conversation
Signed-off-by: Danny Kopping <[email protected]>
…thropic only) Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]>
c57a572 to
d94d846
Compare
| return | ||
| } | ||
|
|
||
| // Initiate the stream once the first event is received. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main fix, besides the provider-specific implementations.
We can't send the SSE headers until we know whether the stream has started. If the upstream request fails before streaming starts, we have to send back a non-200 response. Once SSE headers are sent, we can't do that.
Signed-off-by: Danny Kopping <[email protected]>
Closes #56
Also introduces a new test struct named
mockHTTPReflectorwhich reflects an entire HTTP response fixture. This should be the approach going forward, instead of the somewhat jankymockServer. You'll notice in the modified fixtures that they contain a full HTTP payload instead of just the response body. I think this makes it a lot cleaner and more idiomatic.