convertError<BodyType, InnerType> method

  1. @override
FutureOr<Response> convertError<BodyType, InnerType>(
  1. Response response
)

Converts the received Response to a Response which has a body with the HTTP representation of the original body.

Implementation

@override
FutureOr<Response> convertError<BodyType, InnerType>(Response response) {
  // if (response.body is String) {
  //   return response.copyWith(
  //       body: decode<GeneralErrorModel, GeneralErrorModel>(
  //           {"error": response.body}));
  // }
  return response.copyWith(
      bodyError: decode<BodyType, BodyType>(json.decode(response.body)));
}