commit | c140142a34c1a2c748daf66064f9c6b08c0ad831 | [log] [tgz] |
---|---|---|
author | Alexander Thomas <athom@google.com> | Mon Feb 01 17:55:35 2021 +0100 |
committer | GitHub <noreply@github.com> | Mon Feb 01 08:55:35 2021 -0800 |
tree | 1c1a8d74c712f2eb5cc4b1590f915442b97dad0e | |
parent | 957090e70b493f15b93b933ea40a6987267b8bb3 [diff] |
Migrate to GitHub Actions (#16) * Migrate to GitHub Actions * Delete .travis.yml * Update test-package.yml
Middleware for the http
package that transparently retries failing requests.
To use this, just create an RetryClient
that wraps the underlying http.Client
:
import 'package:http/http.dart' as http; import 'package:http_retry/http_retry.dart'; Future<void> main() async { final client = RetryClient(http.Client()); try { print(await client.read('http://example.org')); } finally { client.close(); } }
By default, this retries any request whose response has status code 503 Temporary Failure up to three retries. It waits 500ms before the first retry, and increases the delay by 1.5x each time. All of this can be customized using the RetryClient()
constructor.