OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library http_throttle; | |
6 | |
7 import 'dart:async'; | 5 import 'dart:async'; |
8 | 6 |
9 import 'package:http/http.dart'; | 7 import 'package:http/http.dart'; |
10 import 'package:pool/pool.dart'; | 8 import 'package:pool/pool.dart'; |
11 | 9 |
12 /// A middleware client that throttles the number of concurrent requests. | 10 /// A middleware client that throttles the number of concurrent requests. |
13 /// | 11 /// |
14 /// As long as the number of requests is within the limit, this works just like | 12 /// As long as the number of requests is within the limit, this works just like |
15 /// a normal client. If a request is made beyond the limit, the underlying HTTP | 13 /// a normal client. If a request is made beyond the limit, the underlying HTTP |
16 /// request won't be sent until other requests have completed. | 14 /// request won't be sent until other requests have completed. |
(...skipping 24 matching lines...) Expand all Loading... |
41 headers: response.headers, | 39 headers: response.headers, |
42 isRedirect: response.isRedirect, | 40 isRedirect: response.isRedirect, |
43 persistentConnection: response.persistentConnection, | 41 persistentConnection: response.persistentConnection, |
44 reasonPhrase: response.reasonPhrase); | 42 reasonPhrase: response.reasonPhrase); |
45 }); | 43 }); |
46 }); | 44 }); |
47 } | 45 } |
48 | 46 |
49 void close() => _inner.close(); | 47 void close() => _inner.close(); |
50 } | 48 } |
OLD | NEW |