22// Use of this source code is governed by a BSD-style license that can be
33// found in the LICENSE file.
44
5- import 'dart:io' ;
5+ import 'dart:io' as io ;
66
77import 'package:appengine/appengine.dart' ;
88import 'package:cocoon_server/google_auth_provider.dart' ;
@@ -20,6 +20,7 @@ import 'package:cocoon_service/src/service/firebase_jwt_validator.dart';
2020import 'package:cocoon_service/src/service/flags/dynamic_config_updater.dart' ;
2121import 'package:cocoon_service/src/service/get_files_changed.dart' ;
2222import 'package:cocoon_service/src/service/scheduler/ci_yaml_fetcher.dart' ;
23+ import 'package:http/http.dart' as http;
2324import 'package:logging/logging.dart' ;
2425
2526Future <void > main () async {
@@ -53,6 +54,7 @@ Future<void> main() async {
5354 projectId: Config .flutterGcpProjectId,
5455 ),
5556 initialConfig: dynamicConfig,
57+ httpClient: MappingHttpClient (http.Client ()),
5658 );
5759 // Start updating the config to loop forever. If this fails, it will log
5860 // every ~1 minute.
@@ -75,12 +77,16 @@ Future<void> main() async {
7577
7678 final buildBucketClient = BuildBucketClient (
7779 accessTokenService: AccessTokenService .defaultProvider (config),
80+ httpClient: config.httpClient,
7881 );
7982
8083 // Gerrit service class to communicate with GoB.
8184 final gerritService = GerritService (
8285 config: config,
83- authClient: await const GoogleAuthProvider ().createClient (scopes: []),
86+ authClient: await const GoogleAuthProvider ().createClient (
87+ baseClient: config.httpClient,
88+ scopes: [],
89+ ),
8490 );
8591
8692 /// LUCI service class to communicate with buildBucket service.
@@ -155,10 +161,10 @@ Future<void> main() async {
155161 );
156162
157163 return runAppEngine (
158- (HttpRequest request) async {
164+ (io. HttpRequest request) async {
159165 await server (request.toRequest ());
160166 },
161- onAcceptingConnections: (InternetAddress address, int port) {
167+ onAcceptingConnections: (io. InternetAddress address, int port) {
162168 final host = address.isLoopback ? 'localhost' : address.host;
163169 print ('Serving requests at http://$host :$port /' );
164170 },
0 commit comments