Index: tools/gardening/lib/src/util.dart |
diff --git a/tools/gardening/lib/src/util.dart b/tools/gardening/lib/src/util.dart |
index 51b50c1e3dec79d037401a16254d3a4046ee07ee..ba80e6e6372bec8609051e3cf99dc7977762461b 100644 |
--- a/tools/gardening/lib/src/util.dart |
+++ b/tools/gardening/lib/src/util.dart |
@@ -65,14 +65,19 @@ class HttpException implements Exception { |
} |
/// Reads the content of [uri] as text. |
-Future<String> readUriAsText(HttpClient client, Uri uri) async { |
+Future<String> readUriAsText( |
+ HttpClient client, Uri uri, Duration timeout) async { |
HttpClientRequest request = await client.getUrl(uri); |
HttpClientResponse response = await request.close(); |
if (response.statusCode != 200) { |
response.drain(); |
throw new HttpException(uri, response.statusCode); |
} |
- return response.transform(UTF8.decoder).join(); |
+ if (timeout != null) { |
+ return response.timeout(timeout).transform(UTF8.decoder).join(); |
+ } else { |
+ return response.transform(UTF8.decoder).join(); |
+ } |
} |
ArgParser createArgParser() { |