Chromium Code Reviews| Index: sdk/lib/io/http_multipart_form_data.dart |
| diff --git a/sdk/lib/io/http_multipart_form_data.dart b/sdk/lib/io/http_multipart_form_data.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..23447e7af5f21c08d5138c47116c37065e682c5f |
| --- /dev/null |
| +++ b/sdk/lib/io/http_multipart_form_data.dart |
| @@ -0,0 +1,64 @@ |
| +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +part of dart.io; |
| + |
| + |
| +/** |
| + * [:HttpMultipartFormData:] class used for 'upgrading' a [MimeMultipart] by |
| + * parsing it as a 'multipart/form-data' part. The following code shows how |
| + * it can be used. |
|
Søren Gjesse
2013/05/06 13:46:34
What code?
Anders Johnsen
2013/05/06 14:07:55
Done.
|
| + * |
| + * |
| + * [:HttpMultipartFormData:] is a Stream, serving either bytes or decoded |
| + * Strings. Use [isText] or [isBinary] to see what type of data is provided. |
| + */ |
| +abstract class HttpMultipartFormData implements Stream { |
| + /** |
| + * The parsed [:Content-Type:] heaver of the [:HttpMultipartFormData:]. |
|
Søren Gjesse
2013/05/06 13:46:34
heaver?
Anders Johnsen
2013/05/06 14:07:55
Done.
|
| + * Returns [:null:] if not present. |
| + */ |
| + ContentType get contentType; |
| + |
| + /** |
| + * The parsed [:Content-Disposition:] header of the [:HttpMultipartFormData:]. |
| + * This field is always present. Use this extract e.g. name and filename |
|
Søren Gjesse
2013/05/06 13:46:34
Use this -> Use this to
Søren Gjesse
2013/05/06 13:46:34
name -> name (form field name)
Søren Gjesse
2013/05/06 13:46:34
filename -> filename (client provided name of uplo
Anders Johnsen
2013/05/06 14:07:55
Done.
Anders Johnsen
2013/05/06 14:07:55
Done.
Anders Johnsen
2013/05/06 14:07:55
Done.
|
| + * parameters. |
| + */ |
| + HeaderValue get contentDisposition; |
| + |
| + /** |
| + * The parsed [:Content-Transfer-Encoding:] header of the |
| + * [:HttpMultipartFormData:]. This field is used to determine how to decode |
| + * the data. Returns [:null:] if not present. |
| + */ |
| + HeaderValue get contentTransferEncoding; |
| + |
| + /** |
| + * Returns [:true:] if the data is decoded as [String]. |
| + */ |
| + bool get isText; |
| + |
| + /** |
| + * Returns [:true:] if the data is raw bytes. |
| + */ |
| + bool get isBinary; |
| + |
| + /** |
| + * Returns the value for the header named [name]. If there |
| + * is no header with the provided name, [:null:] will be returned. |
| + * |
| + * Use this method to index other headers available in the original |
| + * [MimeMultipart]. |
| + */ |
| + String value(String name); |
| + |
| + /** |
| + * Parse a [MimeMultipart] and return a [HttpMultipartFormData]. If the |
| + * [:Content-Disposition:] header is missing or invalid, a [HttpException] is |
| + * thrown. |
| + */ |
| + static HttpMultipartFormData parse(MimeMultipart multipart) |
| + => _HttpMultipartFormData.parse(multipart); |
| +} |