Repository navigation
Conversation
Member
|
This is great, thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A service whose only HTTP endpoints are WebSocket streams generates a server
encode_decode.gothat does not compile when any of those endpoints maps an error to a status code:The server codec renders an error encoder for every non-JSON-RPC endpoint with HTTP errors, WebSocket endpoints included, and the error encoder signature uses
context.Context.httpServerCodecUsesContextskipped WebSocket endpoints entirely, so the codec file never planned thecontextimport. A service that has at least one ordinary HTTP endpoint hides the bug, because that endpoint's response encoder brings the import in.httpServerCodecUsesContextnow reportstruefor any non-JSON-RPC endpoint with HTTP errors, and still skips the response encoder case for WebSocket and redirect endpoints. Behavior only changes for WebSocket endpoints with mapped errors.The new test renders a WebSocket-only service with and without a mapped error. It checks the planned server codec imports, then compiles the generated packages.