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

Side by Side Diff: sdk/lib/io/http.dart

Issue 195893019: Add fixed content type values for commonly used content types (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/standalone/io/http_headers_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 * HTTP status codes. 8 * HTTP status codes.
9 */ 9 */
10 abstract class HttpStatus { 10 abstract class HttpStatus {
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 bool get isNew; 583 bool get isNew;
584 } 584 }
585 585
586 586
587 /** 587 /**
588 * Representation of a content type. An instance of [ContentType] is 588 * Representation of a content type. An instance of [ContentType] is
589 * immutable. 589 * immutable.
590 */ 590 */
591 abstract class ContentType implements HeaderValue { 591 abstract class ContentType implements HeaderValue {
592 /** 592 /**
593 * Content type for plain text using UTF-8 encoding.
594 *
595 * text/plain; charset=utf-8
596 */
597 static final TEXT = new ContentType("text", "plain", charset: "utf-8");
598
599 /**
600 * Content type for HTML using UTF-8 encoding.
601 *
602 * text/html; charset=utf-8
603 */
604 static final HTML = new ContentType("text", "html", charset: "utf-8");
605
606 /**
607 * Content type for JSON using UTF-8 encoding.
608 *
609 * application/json; charset=utf-8
610 */
611 static final JSON = new ContentType("application", "json", charset: "utf-8");
612
613 /**
614 * Content type for binary data.
615 *
616 * application/octet-stream
617 */
618 static final BINARY = new ContentType("application", "octet-stream");
619
620 /**
593 * Creates a new content type object setting the primary type and 621 * Creates a new content type object setting the primary type and
594 * sub type. The charset and additional parameters can also be set 622 * sub type. The charset and additional parameters can also be set
595 * using [charset] and [parameters]. If charset is passed and 623 * using [charset] and [parameters]. If charset is passed and
596 * [parameters] contains charset as well the passed [charset] will 624 * [parameters] contains charset as well the passed [charset] will
597 * override the value in parameters. Keys and values passed in 625 * override the value in parameters. Keys and values passed in
598 * parameters will be converted to lower case. 626 * parameters will be converted to lower case.
599 */ 627 */
600 factory ContentType(String primaryType, 628 factory ContentType(String primaryType,
601 String subType, 629 String subType,
602 {String charset, Map<String, String> parameters}) { 630 {String charset, Map<String, String> parameters}) {
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 class RedirectException implements HttpException { 1642 class RedirectException implements HttpException {
1615 final String message; 1643 final String message;
1616 final List<RedirectInfo> redirects; 1644 final List<RedirectInfo> redirects;
1617 1645
1618 const RedirectException(this.message, this.redirects); 1646 const RedirectException(this.message, this.redirects);
1619 1647
1620 String toString() => "RedirectException: $message"; 1648 String toString() => "RedirectException: $message";
1621 1649
1622 Uri get uri => redirects.last.location; 1650 Uri get uri => redirects.last.location;
1623 } 1651 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/http_headers_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698