Skip to content

Commit

Permalink
Merge pull request #22 from HeroBalancer/ParameterFix
Browse files Browse the repository at this point in the history
Fixes issue #20 reported by @TruDan
  • Loading branch information
robotdan authored Jun 15, 2020
2 parents 0fa560a + e455243 commit a35b9ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class DefaultRESTClient : IRESTClient {

public String uri = "";

public Dictionary<string, string> parameters = new Dictionary<string, string>();
public List<KeyValuePair<string, string>> parameters = new List<KeyValuePair<string, string>>();

public Dictionary<string, string> headers = new Dictionary<string, string>();

Expand Down Expand Up @@ -146,7 +146,7 @@ public override IRESTClient withUri(string uri) {
* @param value The value of the parameter, may be a string, object or number.
*/
public override IRESTClient withParameter(string name, string value) {
parameters[name] = value;
parameters.Add(new KeyValuePair<string, string>(name, value));
return this;
}

Expand Down
10 changes: 10 additions & 0 deletions fusionauth-netcore-client/src/io/fusionauth/IRESTClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;

Expand Down Expand Up @@ -101,6 +103,14 @@ public IRESTClient withParameter(string name, object value) {
return withParameter(name, value.ToString());
}

public IRESTClient withParameter<T>(string name, IEnumerable<T> value)
{
if (value == null)
return this;

return value.Aggregate(this, (current, val) => current.withParameter(name, val));
}

/**
* Run the request and return a promise. This promise will resolve if the request is successful
* and reject otherwise.
Expand Down

0 comments on commit a35b9ed

Please sign in to comment.