-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change
StatusCode
to handle unknown status codes
Tide's design of their status code type (which we copied) as an enum, is not resilient against new status codes or status codes unknown to the server framework (such as ELB-specific status codes). This caused a panic in a Cappuccino node when it received a response with a status code it did not recognize. This changes `StatusCode` from an enum to a wrapper around `reqwest::StatusCode`, which is itself a wrapper around a `u16`. As such, it can represent any status code in the allowed range without necessarily knowing what a certain status represents. We keep most of the same interface by reimplementing all the appropriate and conversion traits. However, there are a couple of breaking changes: * We no longer implement `From<StatusCode> for tide::StatusCode`; instead we implement `TryFrom`, so we can return an error instead of panicking if it is a status code that `tide` cannot handle * Since our status code is no longer an enum, we replace enum variant constructors with associated constants, which is the same as what `reqwest` does
- Loading branch information
Showing
13 changed files
with
169 additions
and
537 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Oops, something went wrong.