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

Change StatusCode to handle unknown status codes #230

Merged
merged 3 commits into from
Jun 5, 2024
Merged

Commits on Jun 5, 2024

  1. 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
    jbearer committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    00ec1a4 View commit details
    Browse the repository at this point in the history
  2. Bump version

    jbearer committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    131baa0 View commit details
    Browse the repository at this point in the history
  3. Fix docs

    jbearer committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    859d6bd View commit details
    Browse the repository at this point in the history