Chromium Code Reviews| Index: recipes/dart_io/pkg_http/bin/making_multiple_requests_to_the_same_server.dart |
| diff --git a/recipes/dart_io/pkg_http/bin/making_multiple_requests_to_the_same_server.dart b/recipes/dart_io/pkg_http/bin/making_multiple_requests_to_the_same_server.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..131616392bde1e03611f66f2853ac83fbc60d3ed |
| --- /dev/null |
| +++ b/recipes/dart_io/pkg_http/bin/making_multiple_requests_to_the_same_server.dart |
| @@ -0,0 +1,10 @@ |
| +import 'package:http/http.dart' as http; |
| + |
| +void main() { |
| + var url = 'http://httpbin.org/'; |
| + var client = new http.Client(); |
| + client.post('${url}post', fields: {"name": "doodle", "color": "blue"}) |
|
Anders Johnsen
2013/12/06 11:53:28
Why is this example using post?
shailentuli
2013/12/06 18:16:29
No particular reason except to show that you can d
|
| + .then((response) => client.get(url)) |
| + .then((response) => print(response.body)) |
| + .whenComplete(client.close); |
| +} |