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

Unified Diff: pkg/http/test/utils.dart

Issue 11528005: Reapply "Stop working around issue 6984." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | utils/pub/io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http/test/utils.dart
diff --git a/pkg/http/test/utils.dart b/pkg/http/test/utils.dart
index 9e0d01065f3460934b7e6ada819d74485b8fc8be..3548df015d53e9946732ba29809142a8e777cf3a 100644
--- a/pkg/http/test/utils.dart
+++ b/pkg/http/test/utils.dart
@@ -29,7 +29,7 @@ void startServer() {
(request, response) {
response.statusCode = 400;
response.contentLength = 0;
- closeResponse(request, response);
+ response.outputStream.close();
});
_server.addRequestHandler((request) => request.path == '/loop',
@@ -39,7 +39,7 @@ void startServer() {
response.headers.set('location',
serverUrl.resolve('/loop?${n + 1}').toString());
response.contentLength = 0;
- closeResponse(request, response);
+ response.outputStream.close();
});
_server.addRequestHandler((request) => request.path == '/redirect',
@@ -47,7 +47,7 @@ void startServer() {
response.statusCode = 302;
response.headers.set('location', serverUrl.resolve('/').toString());
response.contentLength = 0;
- closeResponse(request, response);
+ response.outputStream.close();
});
_server.defaultRequestHandler = (request, response) {
@@ -104,15 +104,6 @@ void stopServer() {
_server = null;
}
-/// Closes [response] while ignoring the body of [request].
-///
-/// Due to issue 6984, it's necessary to drain the request body before closing
-/// the response.
-void closeResponse(HttpRequest request, HttpResponse response) {
- request.inputStream.onData = request.inputStream.read;
- request.inputStream.onClosed = response.outputStream.close;
-}
-
/// A matcher that matches JSON that parses to a value that matches the inner
/// matcher.
Matcher parse(matcher) => new _Parse(matcher);
« no previous file with comments | « no previous file | utils/pub/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698