Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6c78f2193 | ||
|
|
dbb9f5b404 | ||
|
|
5bfe876f57 | ||
|
|
6a31a1968e | ||
|
|
43bcbb3c30 | ||
|
|
c66614c2fe | ||
|
|
2885118175 |
@@ -1,7 +1,7 @@
|
||||
## UriBuilder.Fluent
|
||||
[](https://coveralls.io/github/TerribleDev/UriBuilder.Fluent) [](https://ci.appveyor.com/project/tparnell8/uribuilder-fluent/branch/master)
|
||||
|
||||
This places extension methods over System.UriBuilder to help deal with query string parameters, and create more of a fluent interface. Unlike other projects this builds ontop of trusty UriBuilder, and does not use custom Uri generators, or have outside dependencies.
|
||||
This places extension methods over System.UriBuilder to help deal with query string parameters, and create more of a fluent interface. Unlike other projects, this NetStandardLibrary compliant package builds ontop of trusty UriBuilder, does not use custom Uri generators, or have outside dependencies. Unit tests continue to be a first class citizen!
|
||||
|
||||
This lets you do things like
|
||||
|
||||
@@ -29,7 +29,9 @@ new UriBuilder("https://awesome.com/yo)
|
||||
.WithParameter("id", "5")
|
||||
.ToString();
|
||||
|
||||
|
||||
|
||||
```
|
||||
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 available to you!
|
||||
@@ -97,6 +97,16 @@ namespace FluentUriBuilder.Tests
|
||||
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]
|
||||
public void TestAddTwoUrlParameters()
|
||||
{
|
||||
|
||||
@@ -51,11 +51,6 @@ namespace System
|
||||
throw new ArgumentNullException(nameof(pathSegment));
|
||||
}
|
||||
var path = pathSegment.TrimStart('/');
|
||||
if(string.IsNullOrWhiteSpace(bld.Path))
|
||||
{
|
||||
bld.Path = path;
|
||||
return bld;
|
||||
}
|
||||
bld.Path = $"{bld.Path.TrimEnd('/')}/{path}";
|
||||
return bld;
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
"owners": [
|
||||
"Tommy Parnell"
|
||||
],
|
||||
"repository": {
|
||||
"url":"https://github.com/TerribleDev/UriBuilder.Fluent"
|
||||
},
|
||||
"projectUrl": "https://github.com/tparnell8/TurboLinks.Net",
|
||||
"summary": "Fluent extensions for UriBuilder",
|
||||
"tags": [
|
||||
"Url building",
|
||||
@@ -23,7 +21,7 @@
|
||||
"Tommy Parnell"
|
||||
],
|
||||
"frameworks": {
|
||||
"netstandard1.3": {
|
||||
"netstandard1.1": {
|
||||
"imports": "dnxcore50"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user