| Index: sdk/lib/_internal/pub/test/oauth2/utils.dart
|
| diff --git a/sdk/lib/_internal/pub/test/oauth2/utils.dart b/sdk/lib/_internal/pub/test/oauth2/utils.dart
|
| index 5144dade17511ffe2dd3dc8839a9d35c5e99a8eb..fc9b4c511ca8b9e833ed09bb6137729231847c14 100644
|
| --- a/sdk/lib/_internal/pub/test/oauth2/utils.dart
|
| +++ b/sdk/lib/_internal/pub/test/oauth2/utils.dart
|
| @@ -11,6 +11,7 @@ import 'package:http/http.dart' as http;
|
| import 'package:scheduled_test/scheduled_process.dart';
|
| 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 '../../lib/src/utils.dart';
|
| @@ -41,17 +42,13 @@ void authorizePub(ScheduledProcess pub, ScheduledServer server,
|
|
|
| void handleAccessTokenRequest(ScheduledServer server, String accessToken) {
|
| 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'(^|&)code=access\+code(&|$)')));
|
|
|
| - request.response.headers.contentType =
|
| - new ContentType("application", "json");
|
| - request.response.write(JSON.encode({
|
| + return new shelf.Response.ok(JSON.encode({
|
| "access_token": accessToken,
|
| "token_type": "bearer"
|
| - }));
|
| - request.response.close();
|
| + }), headers: {'content-type': 'application/json'});
|
| });
|
| });
|
| }
|
|
|