Index: sdk/lib/io/http.dart |
diff --git a/sdk/lib/io/http.dart b/sdk/lib/io/http.dart |
index 2eddf7ca202419f8c5f59e15e6832a2123389257..8471b34408ba046158981386af6ba3b3caf80ded 100644 |
--- a/sdk/lib/io/http.dart |
+++ b/sdk/lib/io/http.dart |
@@ -676,6 +676,31 @@ abstract class HttpRequest implements Stream<List<int>> { |
/** |
* HTTP response to be send back to the client. |
+ * |
+ * This object has a number of properties for setting up the HTTP |
+ * header of the response. Then the header has been set up the methods |
Anders Johnsen
2013/03/07 16:53:49
Then -> When ?
Søren Gjesse
2013/03/08 09:47:46
Done.
|
+ * from the [IOSink] can be used to write the actual body of the HTTP |
+ * response. When one of the [IOSink] methods this is used for the |
Anders Johnsen
2013/03/07 16:53:49
Remove 'this'.
Søren Gjesse
2013/03/08 09:47:46
Done.
|
+ * first time the request header is send. Calling any methods that |
+ * will change the header after it is sent will throw an exception. |
+ * |
+ * When writing string data through the [IOSink] the encoding used |
+ * will be determined from the "charset" parameter of the |
+ * "Content-Type" header. |
+ * |
+ * HttpResponse response = ... |
+ * response.headers.contentType |
+ * = new ContentType("application", "json", charset: "utf-8"); |
+ * response.write(...); // Strings written will be UTF-8 encoded. |
+ * |
+ * If no charset is provided the default of ISO-8859-1 (Latin 1) will |
+ * be used. |
+ * |
+ * HttpResponse response = ... |
+ * response.headers.add(HttpHeaders.CONTENT_TYPE, "text/plain"); |
+ * response.write(...); // Strings written will be ISO-8859-1 encoded. |
+ * |
+ * If an unsupported encoding is used an exception will be thrown. |
nweiz
2013/03/07 19:32:05
Specify that the exception will only be thrown whe
Søren Gjesse
2013/03/08 09:47:46
Done.
|
*/ |
abstract class HttpResponse implements IOSink<HttpResponse> { |
// TODO(ajohnsen): Add documentation of how to pipe a file to the response. |
@@ -860,13 +885,30 @@ abstract class HttpClient { |
/** |
* HTTP request for a client connection. |
* |
- * The request is an [IOSink], used to write the request data. When |
- * all request data has been written, close the stream to indicate the end of |
- * the request. |
+ * This object has a number of properties for setting up the HTTP |
+ * header of the request. Then the header has been set up the methods |
Anders Johnsen
2013/03/07 16:53:49
Then -> When
Søren Gjesse
2013/03/08 09:47:46
Done.
|
+ * from the [IOSink] can be used to write the actual body of the HTTP |
+ * request. When one of the [IOSink] methods this is used for the |
Anders Johnsen
2013/03/07 16:53:49
Remove 'this'.
Søren Gjesse
2013/03/08 09:47:46
Done.
|
+ * first time the request header is send. Calling any methods that |
+ * will change the header after it is sent will throw an exception. |
+ * |
+ * When writing string data through the [IOSink] the |
+ * encoding used will be determined from the "charset" parameter of |
+ * the "Content-Type" header. |
+ * |
+ * HttpClientRequest request = ... |
+ * request.headers.contentType |
+ * = new ContentType("application", "json", charset: "utf-8"); |
+ * request.write(...); // Strings written will be UTF-8 encoded. |
+ * |
+ * If no charset is provided the default of ISO-8859-1 (Latin 1) will |
+ * be used. |
+ * |
+ * HttpClientRequest request = ... |
+ * request.headers.add(HttpHeaders.CONTENT_TYPE, "text/plain"); |
+ * request.write(...); // Strings written will be ISO-8859-1 encoded. |
* |
- * When this is accessed for the first time the request header is |
- * send. Calling any methods that will change the header after |
- * having retrieved the output stream will throw an exception. |
+ * If an unsupported encoding is used an exception will be thrown. |
nweiz
2013/03/07 19:32:05
Also here.
Søren Gjesse
2013/03/08 09:47:46
Done.
|
*/ |
abstract class HttpClientRequest |
implements IOSink<HttpClientRequest> { |