Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb6675ab94 | ||
|
|
8b053f0f77 |
@@ -22,6 +22,7 @@ namespace System
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bld"></param>
|
/// <param name="bld"></param>
|
||||||
/// <param name="parameterDictionary"></param>
|
/// <param name="parameterDictionary"></param>
|
||||||
|
/// <exception cref="ArgumentNullException"></exception>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static UriBuilder WithParameter(this UriBuilder bld, IDictionary<string, string> parameterDictionary)
|
public static UriBuilder WithParameter(this UriBuilder bld, IDictionary<string, string> parameterDictionary)
|
||||||
{
|
{
|
||||||
@@ -56,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;
|
||||||
@@ -117,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)
|
||||||
{
|
{
|
||||||
@@ -137,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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user