OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library shelf.response; | |
6 | |
7 import 'dart:convert'; | 5 import 'dart:convert'; |
8 | 6 |
9 import 'package:http_parser/http_parser.dart'; | 7 import 'package:http_parser/http_parser.dart'; |
10 | 8 |
11 import 'message.dart'; | 9 import 'message.dart'; |
12 import 'util.dart'; | 10 import 'util.dart'; |
13 | 11 |
14 /// The response returned by a [Handler]. | 12 /// The response returned by a [Handler]. |
15 class Response extends Message { | 13 class Response extends Message { |
16 /// The HTTP status code of the response. | 14 /// The HTTP status code of the response. |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 /// Converts [location], which may be a [String] or a [Uri], to a [String]. | 260 /// Converts [location], which may be a [String] or a [Uri], to a [String]. |
263 /// | 261 /// |
264 /// Throws an [ArgumentError] if [location] isn't a [String] or a [Uri]. | 262 /// Throws an [ArgumentError] if [location] isn't a [String] or a [Uri]. |
265 String _locationToString(location) { | 263 String _locationToString(location) { |
266 if (location is String) return location; | 264 if (location is String) return location; |
267 if (location is Uri) return location.toString(); | 265 if (location is Uri) return location.toString(); |
268 | 266 |
269 throw new ArgumentError('Response location must be a String or Uri, was ' | 267 throw new ArgumentError('Response location must be a String or Uri, was ' |
270 '"$location".'); | 268 '"$location".'); |
271 } | 269 } |
OLD | NEW |