sbstp / attohttpc

Rust lightweight HTTP 1.1 client

Home Page:https://docs.rs/attohttpc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add helper for converting Response into Result based on StatusCode

imp opened this issue · comments

When Response is received it can be checked for success using is_success() method in order to decide on further processing. It may be very helpful to provide a method that will convert Response into Result<Response> based on the the StatusCode.

Other HTTP client libraries provide similar facilities and they are very handy.
For example Python requests has raise_for_status and reqwest has error_for_status.

What do you think?

Hey, this is out in 0.13.0