Skip to content

Improvement/add request timeout handler #108

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

Merged

Conversation

javiermrz
Copy link
Contributor

  • Added the optional property Function() onRequestTimeout to the class InterceptedClient and as parameter of the factory InterceptedClient.build.
  • If onRequestTimeout is defined and the request times out, onRequestTimeout will get executed, and afterwards a TimeoutException will be thrown (the onTimeout handler of a Future only allows callbacks that either throw an error or return a variable of FutureOr<StreamedResponse> in this case). Returning a random/blank response in case of timeout didn't really make sense, throwing an error seemed more correct.

@CodingAleCR
Copy link
Owner

Also, great job! It's really good that you are taking point on this, I really appreciate it and I know library users will too!

@CodingAleCR CodingAleCR self-requested a review March 11, 2022 07:11
@CodingAleCR CodingAleCR merged commit 7b65e4f into CodingAleCR:main Mar 11, 2022
@CodingAleCR
Copy link
Owner

@all-contributors add javiermrz for code

@allcontributors
Copy link
Contributor

@CodingAleCR

I've put up a pull request to add @javiermrz! 🎉

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

Successfully merging this pull request may close these issues.

2 participants