| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of dart.io; | 5 part of dart.io; |
| 6 | 6 |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * [HttpBodyHandler] is a helper class for parsing and collecting HTTP message | 9 * [HttpBodyHandler] is a helper class for parsing and collecting HTTP message |
| 10 * data in an easy-to-use [HttpBody] object. The content body is parsed, | 10 * data in an easy-to-use [HttpBody] object. The content body is parsed, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 /** | 68 /** |
| 69 * A HTTP content body produced by [HttpBodyHandler] for either [HttpRequest] | 69 * A HTTP content body produced by [HttpBodyHandler] for either [HttpRequest] |
| 70 * or [HttpClientResponse]. | 70 * or [HttpClientResponse]. |
| 71 */ | 71 */ |
| 72 abstract class HttpBody { | 72 abstract class HttpBody { |
| 73 /** | 73 /** |
| 74 * The content type e.g. application/json, application/octet-stream, | 74 * The content type e.g. application/json, application/octet-stream, |
| 75 * application/x-www-form-urlencoded, text/plain. | 75 * application/x-www-form-urlencoded, text/plain. |
| 76 */ | 76 */ |
| 77 String get mimeType; | 77 ContentType get contentType; |
| 78 | 78 |
| 79 /** | 79 /** |
| 80 * A high-level type value, that reflects how the body was parsed, e.g. | 80 * A high-level type value, that reflects how the body was parsed, e.g. |
| 81 * "text", "binary" and "json". | 81 * "text", "binary" and "json". |
| 82 */ | 82 */ |
| 83 String get type; | 83 String get type; |
| 84 | 84 |
| 85 /** | 85 /** |
| 86 * The actual body. The type depends on [type]. | 86 * The actual body. The type depends on [type]. |
| 87 */ | 87 */ |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 /** | 136 /** |
| 137 * Returns the request headers. | 137 * Returns the request headers. |
| 138 */ | 138 */ |
| 139 HttpHeaders get headers; | 139 HttpHeaders get headers; |
| 140 | 140 |
| 141 /** | 141 /** |
| 142 * The [HttpResponse] used for responding to the client. | 142 * The [HttpResponse] used for responding to the client. |
| 143 */ | 143 */ |
| 144 HttpResponse get response; | 144 HttpResponse get response; |
| 145 } | 145 } |
| 146 |
| 147 |
| 148 /** |
| 149 * A [HttpBodyFileUpload] object wraps a file upload, presenting a way for |
| 150 * extracting filename, contentType and the data of the uploaded file. |
| 151 */ |
| 152 abstract class HttpBodyFileUpload { |
| 153 /** |
| 154 * The filename of the uploaded file. |
| 155 */ |
| 156 String filename; |
| 157 |
| 158 /** |
| 159 * The [ContentType] of the uploaded file. For 'text/\*' and |
| 160 * 'application/json' the [data] field will a String. |
| 161 */ |
| 162 ContentType contentType; |
| 163 |
| 164 /** |
| 165 * The content of the file. Either a [String] or a [List<int>]. |
| 166 */ |
| 167 dynamic content; |
| 168 } |
| OLD | NEW |