Introduce the FromResponse trait (extends Decodable)

From response should be able to peek at the response, and get the following data:

  • status code
  • headers

Based on this, it should be able to return something. This shifts error handling responsibility onto the FromResponse trait.

For example, something like this should be workable:

Result<Json<ResponseType>, Json<ErrorType>>

By default, the success case would be chosen for any successful (2xx, 3xx) status codes, and the error case for other codes.

Edited by Patrick Elsen