Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Interceptor return types for 6.0.0 #2141

Open
kuhnroyal opened this issue Mar 15, 2024 · 0 comments
Open

Update Interceptor return types for 6.0.0 #2141

kuhnroyal opened this issue Mar 15, 2024 · 0 comments
Labels
p: dio Targeting `dio` package s: feature This issue indicates a feature request
Milestone

Comments

@kuhnroyal
Copy link
Member

Request Statement

Following #2139 we should update the Interceptor function return types.
But this is a breaking change so we can only do this for dio 6.0.0.

Solution Brainstorm

class Interceptor {
  /// The constructor only helps sub-classes to inherit from.
  /// Do not use it directly.
  const Interceptor();

  /// Called when the request is about to be sent.
  FutureOr<void> onRequest(
    RequestOptions options,
    RequestInterceptorHandler handler,
  ) {
    handler.next(options);
  }

  /// Called when the response is about to be resolved.
  FutureOr<void> onResponse(
    Response response,
    ResponseInterceptorHandler handler,
  ) {
    handler.next(response);
  }

  /// Called when an exception was occurred during the request.
  FutureOr<void> onError(
    DioException err,
    ErrorInterceptorHandler handler,
  ) {
    handler.next(err);
  }
}
@kuhnroyal kuhnroyal added the s: feature This issue indicates a feature request label Mar 15, 2024
@kuhnroyal kuhnroyal added this to the 6.0.0 milestone Mar 15, 2024
@kuhnroyal kuhnroyal added the p: dio Targeting `dio` package label Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p: dio Targeting `dio` package s: feature This issue indicates a feature request
Projects
None yet
Development

No branches or pull requests

1 participant