Skip to content

Commit

Permalink
fix issue with overload resolving
Browse files Browse the repository at this point in the history
  • Loading branch information
pwelter34 committed Aug 8, 2024
1 parent 5ca67c4 commit 032a19b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/FluentRest/QueryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,13 @@ public TBuilder AppendPath<TValue>(TValue path)
/// </summary>
/// <param name="paths">The paths to append.</param>
/// <returns>A fluent request builder.</returns>
public TBuilder AppendPath(IEnumerable<string> paths)
public TBuilder AppendPaths(IEnumerable<string> paths)
{
if (paths == null)
return this as TBuilder;

var urlBuilder = RequestMessage.GetUrlBuilder();
urlBuilder.AppendPath(paths);
urlBuilder.AppendPaths(paths);

RequestMessage.Synchronize();

Expand All @@ -245,7 +245,7 @@ public TBuilder AppendPath(IEnumerable<string> paths)
/// </summary>
/// <param name="paths">The paths to append.</param>
/// <returns>A fluent request builder.</returns>
public TBuilder AppendPath(params string[] paths)
public TBuilder AppendPaths(params string[] paths)
{
if (paths == null)
return this as TBuilder;
Expand Down Expand Up @@ -384,7 +384,7 @@ public TBuilder QueryString<TValue>(string name, TValue value)
/// A fluent request builder.
/// </returns>
/// <exception cref="System.ArgumentNullException"><paramref name="name" /> is <see langword="null" />.</exception>
public TBuilder QueryString<TValue>(string name, IEnumerable<TValue> values)
public TBuilder QueryStrings<TValue>(string name, IEnumerable<TValue> values)
{
if (name == null)
throw new ArgumentNullException(nameof(name));
Expand Down
4 changes: 2 additions & 2 deletions src/FluentRest/UrlBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ public UrlBuilder AppendPath<TValue>(TValue path)
/// </summary>
/// <param name="paths">The path segments to append.</param>
/// <returns></returns>
public UrlBuilder AppendPath(IEnumerable<string> paths)
public UrlBuilder AppendPaths(IEnumerable<string> paths)
{
if (paths == null)
return this;
Expand Down Expand Up @@ -462,7 +462,7 @@ public UrlBuilder AppendQuery<TValue>(string name, TValue value)
/// <param name="values">The query string values.</param>
/// <returns></returns>
/// <exception cref="ArgumentNullException">name is <c>null</c></exception>
public UrlBuilder AppendQuery<TValue>(string name, IEnumerable<TValue> values)
public UrlBuilder AppendQueries<TValue>(string name, IEnumerable<TValue> values)
{
if (name == null)
throw new ArgumentNullException(nameof(name));
Expand Down
12 changes: 7 additions & 5 deletions test/FluentRest.Tests/QueryBuilderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ public void QueryStringMultipleList()
var request = new HttpRequestMessage();
var builder = new QueryBuilder(request);

var list = new List<int> { 1, 2 };

builder.BaseUri("http://test.com/");
builder.QueryString("Test", ["Test1", "Test2"]);
builder.QueryStrings("Test", list);

var uri = request.GetUrlBuilder();

Assert.Equal("http://test.com/?Test=Test1&Test=Test2", uri.ToString());
Assert.Equal("http://test.com/?Test=1&Test=2", uri.ToString());
}

[Fact]
Expand Down Expand Up @@ -126,7 +128,7 @@ public void AppendParamsArrayPaths()
var request = new HttpRequestMessage();
var builder = new QueryBuilder(request);

builder.BaseUri("http://test.com/api/").AppendPath("v1", "bar");
builder.BaseUri("http://test.com/api/").AppendPaths("v1", "bar");

var urlBuilder = request.GetUrlBuilder();

Expand All @@ -139,8 +141,8 @@ public void AppendEnumerablePaths()
var request = new HttpRequestMessage();
var builder = new QueryBuilder(request);

IEnumerable<string> enumerablePaths = new List<string>(new[] { "v1", "bar" });
builder.BaseUri("http://test.com/api/").AppendPath(enumerablePaths);
var enumerablePaths = new List<string>(["v1", "bar"]);
builder.BaseUri("http://test.com/api/").AppendPaths(enumerablePaths);

var urlBuilder = request.GetUrlBuilder();

Expand Down

0 comments on commit 032a19b

Please sign in to comment.