Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb6675ab94 |
@@ -35,17 +35,6 @@ namespace FluentUriBuilder.Tests
|
|||||||
.WithParameter("awesome", "yodawg");
|
.WithParameter("awesome", "yodawg");
|
||||||
Assert.Equal("http://awesome.com/?awesome=yodawg", url.Uri.ToString());
|
Assert.Equal("http://awesome.com/?awesome=yodawg", url.Uri.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void PathAndQuery()
|
|
||||||
{
|
|
||||||
var url = new UriBuilder().WithPathSegment("/awesome/v1/").WithParameter("awesome", "cool").PathAndQuery();
|
|
||||||
Assert.Equal("/awesome/v1/?awesome=cool", url);
|
|
||||||
url = new UriBuilder().WithPathSegment("/awesome/v1").WithParameter("awesome", "cool").PathAndQuery();
|
|
||||||
Assert.Equal("/awesome/v1?awesome=cool", url);
|
|
||||||
url = new UriBuilder().WithPathSegment("/awesome/v1").PathAndQuery();
|
|
||||||
Assert.Equal("/awesome/v1", url);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestAddParameterArray()
|
public void TestAddParameterArray()
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
|
"net461": {},
|
||||||
"netcoreapp1.0": {
|
"netcoreapp1.0": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.NETCore.App": {
|
"Microsoft.NETCore.App": {
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ namespace System
|
|||||||
foreach(var value in valuesEnum)
|
foreach(var value in valuesEnum)
|
||||||
{
|
{
|
||||||
var toSValue = value?.ToString();
|
var toSValue = value?.ToString();
|
||||||
if(string.IsNullOrWhiteSpace(toSValue)) continue;
|
//whitespace is valid
|
||||||
|
if(string.IsNullOrEmpty(toSValue)) continue;
|
||||||
// we can't just have an = sign since its valid to have query string paramters with no value;
|
// we can't just have an = sign since its valid to have query string paramters with no value;
|
||||||
if(!validValueHit) toSValue = "=" + value;
|
if(!validValueHit) toSValue = "=" + value;
|
||||||
validValueHit = true;
|
validValueHit = true;
|
||||||
@@ -118,7 +119,7 @@ namespace System
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bld"></param>
|
/// <param name="bld"></param>
|
||||||
/// <param name="host"></param>
|
/// <param name="host"></param>
|
||||||
/// <exception cref="ArgumentNullException">You must pass a ho0st</exception>
|
/// <exception cref="ArgumentNullException">You must pass a host</exception>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static UriBuilder WithHost(this UriBuilder bld, string host)
|
public static UriBuilder WithHost(this UriBuilder bld, string host)
|
||||||
{
|
{
|
||||||
@@ -127,11 +128,6 @@ namespace System
|
|||||||
return bld;
|
return bld;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string PathAndQuery(this UriBuilder bld)
|
|
||||||
{
|
|
||||||
return bld.Path + bld.Query;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Use Https?
|
/// Use Https?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -143,5 +139,7 @@ namespace System
|
|||||||
bld.Scheme = predicate ? "https" : "http";
|
bld.Scheme = predicate ? "https" : "http";
|
||||||
return bld;
|
return bld;
|
||||||
}
|
}
|
||||||
|
public static string ToEscapedString(this Uri bld) => Uri.EscapeUriString(bld.ToString());
|
||||||
|
public static string ToEscapedString(this UriBuilder bld) => Uri.EscapeUriString(bld.Uri.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,19 +14,15 @@
|
|||||||
"extension"
|
"extension"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"NETStandard.Library": "1.6.0"
|
||||||
|
},
|
||||||
"authors": [
|
"authors": [
|
||||||
"Tommy Parnell"
|
"Tommy Parnell"
|
||||||
],
|
],
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"netstandard1.1": {
|
"netstandard1.1": {
|
||||||
"imports": "dnxcore50",
|
|
||||||
"dependencies": {
|
|
||||||
"NETStandard.Library": "1.6.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"net40": {
|
|
||||||
"imports": "dnxcore50"
|
"imports": "dnxcore50"
|
||||||
},
|
}
|
||||||
"net45":{}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user