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 36ef02039ae7e839489eeed79bb27d9e2365aa9f..b2b165555187083beb1b63a96c6a346ec5a49a3c 100644 |
--- a/utils/tests/pub/pub_lish_test.dart |
+++ b/utils/tests/pub/pub_lish_test.dart |
@@ -13,7 +13,7 @@ import '../../pub/io.dart'; |
void handleUploadForm(ScheduledServer server, [Map body]) { |
server.handle('GET', '/packages/versions/new.json', (request, response) { |
- return server.url.transform((url) { |
+ return server.url.chain((url) { |
expect(request.headers.value('authorization'), |
equals('Bearer access token')); |
@@ -29,7 +29,7 @@ void handleUploadForm(ScheduledServer server, [Map body]) { |
response.headers.contentType = new ContentType("application", "json"); |
response.outputStream.writeString(JSON.stringify(body)); |
- response.outputStream.close(); |
+ return closeHttpResponse(request, response); |
}); |
}); |
} |
@@ -38,10 +38,10 @@ void handleUpload(ScheduledServer server) { |
server.handle('POST', '/upload', (request, response) { |
// TODO(nweiz): Once a multipart/form-data parser in Dart exists, validate |
// that the request body is correctly formatted. See issue 6952. |
- return server.url.transform((url) { |
+ return server.url.chain((url) { |
response.statusCode = 302; |
response.headers.set('location', url.resolve('/create').toString()); |
- response.outputStream.close(); |
+ return closeHttpResponse(request, response); |
}); |
}); |
} |
@@ -60,7 +60,7 @@ main() { |
response.outputStream.writeString(JSON.stringify({ |
'success': {'message': 'Package test_pkg 1.0.0 uploaded!'} |
})); |
- response.outputStream.close(); |
+ return closeHttpResponse(request, response); |
}); |
expectLater(pub.nextLine(), equals('Package test_pkg 1.0.0 uploaded!')); |
@@ -84,7 +84,7 @@ main() { |
response.outputStream.writeString(JSON.stringify({ |
'error': {'message': 'your token sucks'} |
})); |
- response.outputStream.close(); |
+ return closeHttpResponse(request, response); |
}); |
expectLater(pub.nextErrLine(), equals('OAuth2 authorization failed (your ' |
@@ -145,7 +145,7 @@ main() { |
response.outputStream.writeString(JSON.stringify({ |
'success': {'message': 'Package test_pkg 1.0.0 uploaded!'} |
})); |
- response.outputStream.close(); |
+ return closeHttpResponse(request, response); |
}); |
pub.shouldExit(0); |
@@ -165,7 +165,7 @@ main() { |
response.outputStream.writeString(JSON.stringify({ |
'error': {'message': 'your request sucked'} |
})); |
- response.outputStream.close(); |
+ return closeHttpResponse(request, response); |
}); |
expectLater(pub.nextErrLine(), equals('your request sucked')); |
@@ -181,7 +181,7 @@ main() { |
server.handle('GET', '/packages/versions/new.json', (request, response) { |
response.outputStream.writeString('{not json'); |
- response.outputStream.close(); |
+ return closeHttpResponse(request, response); |
}); |
expectLater(pub.nextErrLine(), equals('Invalid server response:')); |
@@ -314,7 +314,7 @@ main() { |
server.handle('POST', '/upload', (request, response) { |
// don't set the location header |
- response.outputStream.close(); |
+ return closeHttpResponse(request, response); |
}); |
expectLater(pub.nextErrLine(), equals('Failed to upload the package.')); |
@@ -335,7 +335,7 @@ main() { |
response.outputStream.writeString(JSON.stringify({ |
'error': {'message': 'Your package was too boring.'} |
})); |
- response.outputStream.close(); |
+ return closeHttpResponse(request, response); |
}); |
expectLater(pub.nextErrLine(), equals('Your package was too boring.')); |
@@ -353,7 +353,7 @@ main() { |
server.handle('GET', '/create', (request, response) { |
response.outputStream.writeString('{not json'); |
- response.outputStream.close(); |
+ return closeHttpResponse(request, response); |
}); |
expectLater(pub.nextErrLine(), equals('Invalid server response:')); |
@@ -374,7 +374,7 @@ main() { |
server.handle('GET', '/create', (request, response) { |
response.statusCode = 400; |
response.outputStream.writeString(JSON.stringify(body)); |
- response.outputStream.close(); |
+ return closeHttpResponse(request, response); |
}); |
expectLater(pub.nextErrLine(), equals('Invalid server response:')); |
@@ -394,7 +394,7 @@ main() { |
var body = {'success': 'Your package was awesome.'}; |
server.handle('GET', '/create', (request, response) { |
response.outputStream.writeString(JSON.stringify(body)); |
- response.outputStream.close(); |
+ return closeHttpResponse(request, response); |
}); |
expectLater(pub.nextErrLine(), equals('Invalid server response:')); |