@@ -44,20 +44,17 @@ You can also exert more fine-grained control over your requests and responses by
44
44
creating [ Request] [ ] or [ StreamedRequest] [ ] objects yourself and passing them to
45
45
[ Client.send] [ ] .
46
46
47
- [ Request ] : https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/http/http.Request
48
-
49
- [ StreamedRequest ] : https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/http/http.StreamedRequest
50
-
51
- [ Client.send ] : https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/http/http.Client#id_send
47
+ [ Request ] : https://www.dartdocs.org/documentation/http/latest/http/Request-class.html
48
+ [ StreamedRequest ] : https://www.dartdocs.org/documentation/http/latest/http/StreamedRequest-class.html
49
+ [ Client.send ] : https://www.dartdocs.org/documentation/http/latest/http/Client/send.html
52
50
53
51
This package is designed to be composable. This makes it easy for external
54
52
libraries to work with one another to add behavior to it. Libraries wishing to
55
53
add behavior should create a subclass of [ BaseClient] [ ] that wraps another
56
54
[ Client] [ ] and adds the desired behavior:
57
55
58
- [ BaseClient ] : https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/http/http.BaseClient
59
-
60
- [ Client ] : https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/http/http.Client
56
+ [ BaseClient ] : https://www.dartdocs.org/documentation/http/latest/http/BaseClient-class.html
57
+ [ Client ] : https://www.dartdocs.org/documentation/http/latest/http/Client-class.html
61
58
62
59
``` dart
63
60
class UserAgentClient extends http.BaseClient {
@@ -79,17 +76,20 @@ The HTTP library can be used on the browser via the [BrowserClient][] class in
79
76
` package:http/browser_client.dart ` . This client translates requests into
80
77
XMLHttpRequests. For example:
81
78
79
+ [ BrowserClient ] : https://www.dartdocs.org/documentation/http/latest/http.browser_client/BrowserClient-class.html
80
+
82
81
``` dart
82
+ import 'dart:async';
83
83
import 'package:http/browser_client.dart';
84
- import 'package:http/http.dart' as http;
85
84
86
- var client = new BrowserClient();
87
- var url = "/whatsit/create";
88
- client.post(url, body: {"name": "doodle", "color": "blue"})
89
- .then((response) {
90
- print("Response status: ${response.statusCode}");
91
- print("Response body: ${response.body}");
92
- });
85
+ main() async {
86
+ var client = new BrowserClient();
87
+ var url = '/whatsit/create';
88
+ var response =
89
+ await client.post(url, body: {'name': 'doodle', 'color': 'blue'});
90
+ print('Response status: ${response.statusCode}');
91
+ print('Response body: ${response.body}');
92
+ }
93
93
```
94
94
95
95
## Filing issues
0 commit comments