From a009d71101702df5778452e15e8f4828547d1bc3 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 19 Apr 2019 07:57:04 -0700 Subject: [PATCH] Updated flutter_driver to support auth codes (#31310) --- packages/flutter_driver/lib/src/driver/driver.dart | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/flutter_driver/lib/src/driver/driver.dart b/packages/flutter_driver/lib/src/driver/driver.dart index da078547491..dd06986b601 100644 --- a/packages/flutter_driver/lib/src/driver/driver.dart +++ b/packages/flutter_driver/lib/src/driver/driver.dart @@ -937,8 +937,14 @@ void restoreVmServiceConnectFunction() { /// the [VMServiceClient]. Future _waitAndConnect(String url) async { Uri uri = Uri.parse(url); + final List pathSegments = []; + // If there's an authentication code (default), we need to add it to our path. + if (uri.pathSegments.isNotEmpty) { + pathSegments.add(uri.pathSegments.first); + } + pathSegments.add('ws'); if (uri.scheme == 'http') - uri = uri.replace(scheme: 'ws', path: '/ws'); + uri = uri.replace(scheme: 'ws', pathSegments: pathSegments); int attempts = 0; while (true) { WebSocket ws1;