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

requestTimeout used to be a setter but not anymore with latest version #145

Closed
aytunch opened this issue Jun 24, 2024 · 1 comment
Closed
Assignees
Labels
question Further information is requested

Comments

@aytunch
Copy link

aytunch commented Jun 24, 2024

I am upgrading to the latest packages:

  # http_interceptor: ^1.0.2
  http_interceptor: ^2.0.0-beta.8

I did most of the migrations but in the old code the requestTimeout of InterceptedClient was being set on certain situations. New API does not allow this. How can I migrate?

As a temporary workaround, I am copying my current client and changing the requestTimeout. After response is fetched, I close the copied client. Is this OK?

    final copiedClient = InterceptedClient.build(
      interceptors: _client.interceptors,
      retryPolicy: _client.retryPolicy,
      requestTimeout: requestTimeoutInSeconds == null
          ? defaultRequestTimeout
          : Duration(seconds: requestTimeoutInSeconds),
    );
   
    responseFuture = copiedClient.get(
          uri,
          headers: headers,
        );

    final response = await responseFuture;
    // close the copied client which we used for overriding the timeout value.
    copiedClient.close();


@aytunch aytunch added the question Further information is requested label Jun 24, 2024
@aytunch aytunch changed the title requestTimeout used to be a setter but not anymore with requestTimeout used to be a setter but not anymore with latest version Jun 24, 2024
@CodingAleCR
Copy link
Owner

This is modification not made on purpose, I'll roll that change back so that the previous behavior is still allowed.

#147 takes care of it and it should be available on 2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants