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

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

Issue 21351002: Make the parameters map of the HTTP HeaderValue unmodifiable (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | sdk/lib/io/http_headers.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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 * List<String> values = request.headers[HttpHeaders.ACCEPT]; 490 * List<String> values = request.headers[HttpHeaders.ACCEPT];
491 * values.forEach((value) { 491 * values.forEach((value) {
492 * HeaderValue v = HeaderValue.parse(value); 492 * HeaderValue v = HeaderValue.parse(value);
493 * // Use v.value and v.parameters 493 * // Use v.value and v.parameters
494 * }); 494 * });
495 * 495 *
496 * An instance of [HeaderValue] is immutable. 496 * An instance of [HeaderValue] is immutable.
497 */ 497 */
498 abstract class HeaderValue { 498 abstract class HeaderValue {
499 /** 499 /**
500 * Creates a new header value object setting the value part. 500 * Creates a new header value object setting the value and parameters.
501 */ 501 */
502 factory HeaderValue([String value = "", Map<String, String> parameters]) { 502 factory HeaderValue([String value = "", Map<String, String> parameters]) {
503 return new _HeaderValue(value, parameters); 503 return new _HeaderValue(value, parameters);
504 } 504 }
505 505
506 /** 506 /**
507 * Creates a new header value object from parsing a header value 507 * Creates a new header value object from parsing a header value
508 * string with both value and optional parameters. 508 * string with both value and optional parameters.
509 */ 509 */
510 static HeaderValue parse(String value, 510 static HeaderValue parse(String value,
511 {String parameterSeparator: ";"}) { 511 {String parameterSeparator: ";"}) {
512 return _HeaderValue.parse(value, parameterSeparator: parameterSeparator); 512 return _HeaderValue.parse(value, parameterSeparator: parameterSeparator);
513 } 513 }
514 514
515 /** 515 /**
516 * Gets the header value. 516 * Gets the header value.
517 */ 517 */
518 String get value; 518 String get value;
519 519
520 /** 520 /**
521 * Gets the map of parameters. 521 * Gets the map of parameters.
522 *
523 * This map cannot be modified. invoking any operation which would
524 * modify the map will throw [UnsupportedError].
522 */ 525 */
523 Map<String, String> get parameters; 526 Map<String, String> get parameters;
524 527
525 /** 528 /**
526 * Returns the formatted string representation in the form: 529 * Returns the formatted string representation in the form:
527 * 530 *
528 * value; parameter1=value1; parameter2=value2 531 * value; parameter1=value1; parameter2=value2
529 */ 532 */
530 String toString(); 533 String toString();
531 } 534 }
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 1435
1433 class RedirectException implements HttpException { 1436 class RedirectException implements HttpException {
1434 final String message; 1437 final String message;
1435 final List<RedirectInfo> redirects; 1438 final List<RedirectInfo> redirects;
1436 1439
1437 const RedirectException(String this.message, 1440 const RedirectException(String this.message,
1438 List<RedirectInfo> this.redirects); 1441 List<RedirectInfo> this.redirects);
1439 1442
1440 String toString() => "RedirectException: $message"; 1443 String toString() => "RedirectException: $message";
1441 } 1444 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/io/http_headers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698