Add user:pass support for URI

This commit is contained in:
badaix 2025-02-05 23:01:04 +01:00 committed by Johannes Pohl
parent a72c6948b1
commit 42651476f1
3 changed files with 31 additions and 0 deletions

View file

@ -225,6 +225,22 @@ TEST_CASE("Uri")
REQUIRE(uri.path == "/tmp/snapfifo");
REQUIRE(uri.host.empty());
uri = StreamUri("wss://user:pass@localhost:1788");
REQUIRE(uri.scheme == "wss");
REQUIRE(uri.path.empty());
REQUIRE(uri.host == "localhost");
REQUIRE(uri.user == "user");
REQUIRE(uri.password == "pass");
REQUIRE(uri.port == 1788);
uri = StreamUri("wss://user@localhost:1788");
REQUIRE(uri.scheme == "wss");
REQUIRE(uri.path.empty());
REQUIRE(uri.host == "localhost");
REQUIRE(uri.user == "user");
REQUIRE(uri.password.empty());
REQUIRE(uri.port == 1788);
// uri = StreamUri("scheme:[//host[:port]][/]path[?query=none][#fragment]");
// Test with all fields
uri = StreamUri("scheme://host:42/path?query=none&key=value#fragment");