mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-17 21:54:58 +00:00
fix: Fixing bug where IcdUriBuilder was not correctly appending paths
This commit is contained in:
@@ -63,19 +63,23 @@ namespace ICD.Common.Utils.Tests
|
||||
|
||||
#endregion
|
||||
|
||||
[TestCase("http://localhost/", null, null, null, (ushort)0, null, null, null)]
|
||||
[TestCase("http://localhost:80/", null, null, null, (ushort)80, null, null, null)]
|
||||
[TestCase("http://username@localhost/", null, null, null, (ushort)0, null, null, "username")]
|
||||
[TestCase("http://localhost/", null, null, "password", (ushort)0, null, null, null)]
|
||||
[TestCase("https://localhost/", null, null, null, (ushort)0, null, "https", null)]
|
||||
public void ToStringTest(string expected, string fragment, string address, string password, ushort port, string query,
|
||||
string scheme, string userName)
|
||||
[TestCase("http://localhost/", null, null, null, null, (ushort)0, null, null, null)]
|
||||
[TestCase("http://localhost:80/", null, null, null, null, (ushort)80, null, null, null)]
|
||||
[TestCase("http://username@localhost/", null, null, null, null, (ushort)0, null, null, "username")]
|
||||
[TestCase("http://localhost/", null, null, "password", null, (ushort)0, null, null, null)]
|
||||
[TestCase("https://localhost/", null, null, null, null, (ushort)0, null, "https", null)]
|
||||
[TestCase("http://localhost/test", null, null, null, "test", (ushort)0, null, null, null)]
|
||||
[TestCase("http://localhost/test", null, null, null, "/test", (ushort)0, null, null, null)]
|
||||
[TestCase("http://localhost//test", null, null, null, "//test", (ushort)0, null, null, null)]
|
||||
public void ToStringTest(string expected, string fragment, string address, string password, string path, ushort port,
|
||||
string query, string scheme, string userName)
|
||||
{
|
||||
IcdUriBuilder builder = new IcdUriBuilder
|
||||
{
|
||||
Fragment = fragment,
|
||||
Host = address,
|
||||
Password = password,
|
||||
Path = path,
|
||||
Port = port,
|
||||
Query = query,
|
||||
Scheme = scheme,
|
||||
|
||||
@@ -100,6 +100,7 @@ namespace ICD.Common.Utils
|
||||
}
|
||||
|
||||
// Path
|
||||
if (string.IsNullOrEmpty(Path) || !Path.StartsWith("/"))
|
||||
builder.Append('/');
|
||||
builder.Append(Path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user