Skip to content

Improvement/add request timeout handler#108

Merged
CodingAleCR merged 5 commits intoCodingAleCR:mainfrom
javiermrz:improvement/add-request-timeout-handler
Mar 11, 2022
Merged

Improvement/add request timeout handler#108
CodingAleCR merged 5 commits intoCodingAleCR:mainfrom
javiermrz:improvement/add-request-timeout-handler

Conversation

@javiermrz
Copy link
Copy Markdown
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.

Comment thread lib/http/intercepted_client.dart Outdated
Comment thread lib/http/intercepted_client.dart Outdated
@CodingAleCR
Copy link
Copy Markdown
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
Copy Markdown
Owner

@all-contributors add javiermrz for code

@allcontributors
Copy link
Copy Markdown
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