Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Commit

Permalink
Merge pull request #4 from dotMorten/patch-5
Browse files Browse the repository at this point in the history
Correctly append the query string parameters
  • Loading branch information
supergibbs authored Apr 11, 2019
2 parents d5836a2 + bb51c70 commit a02deef
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/AutomaticSharp/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,13 @@ private async Task<T> GetAsync<T>(string resource, Dictionary<string, string> pa
{
var path = resource;

if (parameters != null)
if (parameters != null && parameters.Count > 0)
{
var query = new FormUrlEncodedContent(parameters).ToString();

if (string.IsNullOrEmpty(query))
path += "?" + query;
path += "?";
foreach(var item in parameters)
{
path += $"{item.Key}={Uri.EscapeDataString(item.Value)}&";
}
}

var request = new HttpRequestMessage(HttpMethod.Get, path);
Expand Down

0 comments on commit a02deef

Please sign in to comment.