README: fix broken links and BrowserClient example (#38)
- Updated links from api.dartlang.org to dartdocs.org.
- BrowserClient was missing.
- BrowserClient example: wrapped bare code in `main` function.
diff --git a/README.md b/README.md
index 72466a9..506bbad 100644
--- a/README.md
+++ b/README.md
@@ -44,20 +44,17 @@
creating [Request][] or [StreamedRequest][] objects yourself and passing them to
[Client.send][].
-[Request]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/http/http.Request
-
-[StreamedRequest]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/http/http.StreamedRequest
-
-[Client.send]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/http/http.Client#id_send
+[Request]: https://www.dartdocs.org/documentation/http/latest/http/Request-class.html
+[StreamedRequest]: https://www.dartdocs.org/documentation/http/latest/http/StreamedRequest-class.html
+[Client.send]: https://www.dartdocs.org/documentation/http/latest/http/Client/send.html
This package is designed to be composable. This makes it easy for external
libraries to work with one another to add behavior to it. Libraries wishing to
add behavior should create a subclass of [BaseClient][] that wraps another
[Client][] and adds the desired behavior:
-[BaseClient]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/http/http.BaseClient
-
-[Client]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/http/http.Client
+[BaseClient]: https://www.dartdocs.org/documentation/http/latest/http/BaseClient-class.html
+[Client]: https://www.dartdocs.org/documentation/http/latest/http/Client-class.html
```dart
class UserAgentClient extends http.BaseClient {
@@ -79,17 +76,20 @@
`package:http/browser_client.dart`. This client translates requests into
XMLHttpRequests. For example:
-```dart
-import 'package:http/browser_client.dart';
-import 'package:http/http.dart' as http;
+[BrowserClient]: https://www.dartdocs.org/documentation/http/latest/http.browser_client/BrowserClient-class.html
-var client = new BrowserClient();
-var url = "/whatsit/create";
-client.post(url, body: {"name": "doodle", "color": "blue"})
- .then((response) {
- print("Response status: ${response.statusCode}");
- print("Response body: ${response.body}");
-});
+```dart
+import 'dart:async';
+import 'package:http/browser_client.dart';
+
+main() async {
+ var client = new BrowserClient();
+ var url = '/whatsit/create';
+ var response =
+ await client.post(url, body: {'name': 'doodle', 'color': 'blue'});
+ print('Response status: ${response.statusCode}');
+ print('Response body: ${response.body}');
+}
```
## Filing issues