chopper icon indicating copy to clipboard operation
chopper copied to clipboard

Modification of response in ResponseInterceptor throw error

Open zakir01913 opened this issue 5 years ago • 2 comments

I am using chopper 3.0.1.

class ResponseInterceptorImp extends ResponseInterceptor {
  @override
  FutureOr<Response> onResponse(Response response) {
    return response.replace(bodyError: "Error occurred");
  }
}

type Response<dynamic> is not a subtype of type Response<BuiltList<Post>>

zakir01913 avatar Nov 07 '19 15:11 zakir01913

@Guldem was this fixed in #547?

techouse avatar Apr 05 '24 18:04 techouse

Not sure what the issue is here. Looks like the replace function doesn't apply the correct BodyType.

Currently there is no replace only copyWith which works with this as far I know. Other thing here is: Chopper doesn't allow modification of the request and response bodies in a interceptor., only in converters.

#547 Doesn't change any of these constraints currently.

Guldem avatar Apr 06 '24 18:04 Guldem