Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43bcbb3c30 | ||
|
|
c66614c2fe | ||
|
|
2885118175 |
@@ -29,7 +29,9 @@ new UriBuilder("https://awesome.com/yo)
|
|||||||
.WithParameter("id", "5")
|
.WithParameter("id", "5")
|
||||||
.ToString();
|
.ToString();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
result: `https://awesome.com/yo?id=5`
|
result: `https://awesome.com/yo?id=5`
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
|
Just install the nuget package `install-package UriBuilder.Fluent` and thats it. The extension methods should be avalbile to you!
|
||||||
@@ -97,6 +97,16 @@ namespace FluentUriBuilder.Tests
|
|||||||
Assert.Equal(url.Host, "yodawg.com");
|
Assert.Equal(url.Host, "yodawg.com");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void AddParamWithNoValue()
|
||||||
|
{
|
||||||
|
var url = new UriBuilder("http://awesome.com")
|
||||||
|
.WithParameter("awesome", "yodawg")
|
||||||
|
.WithParameter("fun", null)
|
||||||
|
.WithParameter("cool", string.Empty);
|
||||||
|
Assert.Equal("http://awesome.com/?awesome=yodawg&fun&cool", url.Uri.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestAddTwoUrlParameters()
|
public void TestAddTwoUrlParameters()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,11 +51,6 @@ namespace System
|
|||||||
throw new ArgumentNullException(nameof(pathSegment));
|
throw new ArgumentNullException(nameof(pathSegment));
|
||||||
}
|
}
|
||||||
var path = pathSegment.TrimStart('/');
|
var path = pathSegment.TrimStart('/');
|
||||||
if(string.IsNullOrWhiteSpace(bld.Path))
|
|
||||||
{
|
|
||||||
bld.Path = path;
|
|
||||||
return bld;
|
|
||||||
}
|
|
||||||
bld.Path = $"{bld.Path.TrimEnd('/')}/{path}";
|
bld.Path = $"{bld.Path.TrimEnd('/')}/{path}";
|
||||||
return bld;
|
return bld;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,7 @@
|
|||||||
"owners": [
|
"owners": [
|
||||||
"Tommy Parnell"
|
"Tommy Parnell"
|
||||||
],
|
],
|
||||||
"repository": {
|
"projectUrl": "https://github.com/tparnell8/TurboLinks.Net",
|
||||||
"url":"https://github.com/TerribleDev/UriBuilder.Fluent"
|
|
||||||
},
|
|
||||||
"summary": "Fluent extensions for UriBuilder",
|
"summary": "Fluent extensions for UriBuilder",
|
||||||
"tags": [
|
"tags": [
|
||||||
"Url building",
|
"Url building",
|
||||||
|
|||||||
Reference in New Issue
Block a user