Imagine a case where you expect expect a JSON array in the body if the request is successful and a JSON dictionary body in case the server returns a 400 status code.
The error decoder signature now looks like this:
func error(from jsonArray: [Any]) -> Error?
it would be nice if it were something like:
func error(from json: Any, statusCode: Int) -> Error?
or maybe even more generic, providing the raw Data as a parameter.
This issue applies also to the other specialised resource types.
Imagine a case where you expect expect a JSON array in the body if the request is successful and a JSON dictionary body in case the server returns a 400 status code.
The error decoder signature now looks like this:
it would be nice if it were something like:
or maybe even more generic, providing the raw
Dataas a parameter.This issue applies also to the other specialised resource types.