Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Unified Diff: pkg/http/README.md

Issue 261763002: Rip out the last dart:io dependency from pkg/http. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/http/CHANGELOG.md ('k') | pkg/http/lib/browser_client.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http/README.md
diff --git a/pkg/http/README.md b/pkg/http/README.md
index 81ca28630e50e2e5a1af400e8c98cf15064441ea..72466a9e2fbfe29567803dada0714a1b393b0aa3 100644
--- a/pkg/http/README.md
+++ b/pkg/http/README.md
@@ -3,15 +3,14 @@
A composable, Future-based library for making HTTP requests.
This package contains a set of high-level functions and classes that make it
-easy to consume HTTP resources.
-
-**NOTE:** This package currently only works for
-server-side or command-line Dart applications. In other words, if the app
-imports `dart:io`, it can use this package.
+easy to consume HTTP resources. It's platform-independent, and can be used on
+both the command-line and the browser. Currently the global utility functions
+are unsupported on the browser; see "Using on the Browser" below.
## Using
-The easiest way to use this library is via the top-level functions. They allow
+The easiest way to use this library is via the top-level functions, although
+they currently only work on platforms where `dart:io` is available. They allow
you to make individual HTTP requests with minimal hassle:
```dart
@@ -74,6 +73,25 @@ class UserAgentClient extends http.BaseClient {
}
```
+## Using on the Browser
+
+The HTTP library can be used on the browser via the [BrowserClient][] class in
+`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;
+
+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}");
+});
+```
+
## Filing issues
Please file issues for the http package at [http://dartbug.com/new][bugs].
« no previous file with comments | « pkg/http/CHANGELOG.md ('k') | pkg/http/lib/browser_client.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698