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

Unified Diff: sdk/lib/_internal/pub/test/oauth2/with_an_expired_credentials_refreshes_and_saves_test.dart

Issue 216373004: Use shelf handlers in ScheduledServer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 9 months 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
Index: sdk/lib/_internal/pub/test/oauth2/with_an_expired_credentials_refreshes_and_saves_test.dart
diff --git a/sdk/lib/_internal/pub/test/oauth2/with_an_expired_credentials_refreshes_and_saves_test.dart b/sdk/lib/_internal/pub/test/oauth2/with_an_expired_credentials_refreshes_and_saves_test.dart
index ac6fc55082bd188ca215db394f22386ff257cfbc..b2627b6d378961f9502b64d3b0ab85e0087409ab 100644
--- a/sdk/lib/_internal/pub/test/oauth2/with_an_expired_credentials_refreshes_and_saves_test.dart
+++ b/sdk/lib/_internal/pub/test/oauth2/with_an_expired_credentials_refreshes_and_saves_test.dart
@@ -7,6 +7,7 @@ import 'dart:io';
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/scheduled_server.dart';
+import 'package:shelf/shelf.dart' as shelf;
import '../../lib/src/io.dart';
import '../descriptor.dart' as d;
@@ -28,26 +29,22 @@ main() {
confirmPublish(pub);
server.handle('POST', '/token', (request) {
- return new ByteStream(request).toBytes().then((bytes) {
- var body = new String.fromCharCodes(bytes);
+ return request.readAsString().then((body) {
expect(body, matches(
new RegExp(r'(^|&)refresh_token=refresh\+token(&|$)')));
- request.response.headers.contentType =
- new ContentType("application", "json");
- request.response.write(JSON.encode({
+ return new shelf.Response.ok(JSON.encode({
"access_token": "new access token",
"token_type": "bearer"
- }));
- request.response.close();
+ }), headers: {'content-type': 'application/json'});
});
});
server.handle('GET', '/api/packages/versions/new', (request) {
- expect(request.headers.value('authorization'),
- equals('Bearer new access token'));
+ expect(request.headers,
+ containsPair('authorization', 'Bearer new access token'));
- request.response.close();
+ return new shelf.Response(200);
});
pub.shouldExit();

Powered by Google App Engine
This is Rietveld 408576698