[flutter_tools] use Url path.Context for joining URI (#79566)

This commit is contained in:
Jonah Williams
2021-04-01 11:32:49 -07:00
committed by GitHub
parent 66af44c9fe
commit e870f5d123
3 changed files with 28 additions and 2 deletions

View File

@@ -643,6 +643,19 @@ void main() {
expect(processVmServiceMessage(event), 'Hello There');
});
testUsingContext('WebSocket URL construction uses correct URI join primitives', () async {
final Completer<String> completer = Completer<String>();
openChannelForTesting = (String url, {io.CompressionOptions compression}) async {
completer.complete(url);
throw Exception('');
};
// Construct a URL that does not end in a `/`.
await expectLater(() => connectToVmService(Uri.parse('http://localhost:8181/foo')), throwsException);
expect(await completer.future, 'ws://localhost:8181/foo/ws');
openChannelForTesting = null;
});
}
class MockVMService extends Fake implements vm_service.VmService {