[flutter_tools] detect ipv6 in fuchsia server url (#55605)

This commit is contained in:
Jonah Williams
2020-04-24 17:03:04 -07:00
committed by GitHub
parent 35edbe3d9d
commit cf0fcd4536
2 changed files with 11 additions and 1 deletions

View File

@@ -192,7 +192,7 @@ class FuchsiaPackageServer {
Process _process;
/// The URL that can be used by the device to access this package server.
String get url => 'http://$_host:$_port';
String get url => Uri(scheme: 'http', host: _host, port: _port).toString();
// The name used to reference the server by fuchsia-pkg:// urls.
final String name;

View File

@@ -71,6 +71,16 @@ void main() {
FuchsiaArtifacts: () => mockFuchsiaArtifacts,
ProcessManager: () => mockProcessManager,
});
testWithoutContext('ipv6 formatting logic of FuchsiaPackageServer', () {
const String host = 'fe80::ec4:7aff:fecc:ea8f%eno2';
const int port = 23;
expect(
FuchsiaPackageServer('a', 'b', host, port).url,
'http://[fe80::ec4:7aff:fecc:ea8f%25eno2]:23',
);
});
});
}