Chromium Code Reviews

Unified Diff: pkg/shelf/lib/src/response.dart

Issue 227563010: pkg/shelf: case-insensitive headers, cleaner Request ctor, a lot more tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: pkg/shelf/lib/src/response.dart
diff --git a/pkg/shelf/lib/src/response.dart b/pkg/shelf/lib/src/response.dart
index 07eba1b4db4e360b59fbf1c04613a1c4c3fa34de..bbdb8b3d73f2d687ab02ec674a268c4b51115e9c 100644
--- a/pkg/shelf/lib/src/response.dart
+++ b/pkg/shelf/lib/src/response.dart
@@ -7,7 +7,6 @@ library shelf.response;
import 'dart:async';
import 'dart:convert';
-import 'package:collection/wrappers.dart';
import 'package:http_parser/http_parser.dart';
import 'message.dart';
@@ -221,19 +220,18 @@ Stream<List<int>> _bodyToStream(body, Encoding encoding) {
/// Adds information about [encoding] to [headers].
///
/// Returns a new map without modifying [headers].
-UnmodifiableMapView<String, String> _adjustHeaders(
+Map<String, String> _adjustHeaders(
Map<String, String> headers, Encoding encoding) {
if (headers == null) headers = const {};
- if (encoding == null) return new UnmodifiableMapView(headers);
+ if (encoding == null) return headers;
if (headers['content-type'] == null) {
- return new UnmodifiableMapView(_addHeader(headers, 'content-type',
- 'application/octet-stream; charset=${encoding.name}'));
+ return _addHeader(headers, 'content-type',
+ 'application/octet-stream; charset=${encoding.name}');
}
var contentType = new MediaType.parse(headers['content-type'])
.change(parameters: {'charset': encoding.name});
- return new UnmodifiableMapView(
- _addHeader(headers, 'content-type', contentType.toString()));
+ return _addHeader(headers, 'content-type', contentType.toString());
}
/// Adds a header with [name] and [value] to [headers], which may be null.

Powered by Google App Engine