-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In Connect unary protocol, fallback to code based on HTTP status if u…
…nable to deserialize it (#702) The spec states the following: When reading data from the wire, client implementations must use the HTTP-to-Connect mapping to infer a Connect error code if Bare-Message is missing or malformed. However, connect-go was only considering the message to be malformed if json.Unmarshal failed. Because Go's encoding/json package is fairly lenient in many ways, there were many kinds of malformed responses that would be accepted, such as the "code" property being absent or null. In these cases, connect-go was always falling back to using "unknown" as the code, instead of using the HTTP-to-Connect mapping as required by the spec. This addresses that and reconciles connect-go's behavior with the specification.
- Loading branch information
Showing
3 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# The current v1.0.0-rc3 of conformance suite wants to see "unknown" | ||
# as the status for Connect unary responses where the JSON error body | ||
# is missing the 'code' property. But we instead want clients to | ||
# synthesize an error code from the HTTP status code. That way, if | ||
# a proxy or middle-box happens to reply with a JSON error, but not | ||
# a valid *Connect* error, we can use the HTTP status to derive an | ||
# error code, just like we do when the response has an unexpected | ||
# content type. | ||
# | ||
# So after we fix the tests in the conformance suite, we can remove | ||
# these lines below. | ||
Connect Error and End-Stream/**/error/missing-code | ||
Connect Error and End-Stream/**/error/null | ||
Connect Error and End-Stream/**/error/null-code |
This file contains 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
This file contains 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