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

Unified Diff: utils/tests/pub/pub_lish_test.dart

Issue 11411273: Get curl uploads working on Mac. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix test. Created 8 years, 1 month 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
« utils/pub/curl_client.dart ('K') | « utils/pub/curl_client.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/tests/pub/pub_lish_test.dart
diff --git a/utils/tests/pub/pub_lish_test.dart b/utils/tests/pub/pub_lish_test.dart
index 07c24fbbdd689587f557866289516c390d9e702d..d37962923de6596f491a0dcc77da259b1a289b5b 100644
--- a/utils/tests/pub/pub_lish_test.dart
+++ b/utils/tests/pub/pub_lish_test.dart
@@ -204,11 +204,17 @@ main() {
handleUploadForm(server);
server.handle('POST', '/upload', (request, response) {
- response.statusCode = 400;
- response.headers.contentType = new ContentType('application', 'xml');
- response.outputStream.writeString('<Error><Message>Your request sucked.'
- '</Message></Error>');
- return closeHttpResponse(request, response);
+ // TODO(rnystrom): HTTP requires that you don't start sending a response
nweiz 2012/11/30 01:19:45 It's probably worth mentioning that curl will actu
Bob Nystrom 2012/11/30 01:42:45 Done.
+ // until the request has been completely sent, but dart:io doesn't
+ // ensure that (#7044). Workaround it by manually consuming the entire
+ // input stream before we start responding.
+ return consumeInputStream(request.inputStream).transform((_) {
+ response.statusCode = 400;
+ response.headers.contentType = new ContentType('application', 'xml');
+ response.outputStream.writeString('<Error><Message>Your request sucked.'
+ '</Message></Error>');
+ response.outputStream.close();
+ });
});
// TODO(nweiz): This should use the server's error message once the client
« utils/pub/curl_client.dart ('K') | « utils/pub/curl_client.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698