Skip to content

Commit

Permalink
Fix URL encoding for input args
Browse files Browse the repository at this point in the history
  • Loading branch information
discosultan committed Jan 14, 2018
1 parent f9de124 commit 6147afa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/KrakenClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ private async Task<KrakenResponse<T>> SendRequest<T>(HttpRequestMessage req, int

private static string UrlEncode(Dictionary<string, string> args) => string.Join(
"&",
args.Where(x => x.Value != null).Select(x => x.Key + "=" + x.Value)
args.Where(x => x.Value != null).Select(x => x.Key + "=" + WebUtility.UrlEncode(x.Value))
);
}
}
1 change: 1 addition & 0 deletions tests/KrakenClient.PrivateApi.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ public async Task AddStandardOrder()
"buy",
"market",
volume: 0.1m,
expireTime: "+60",
validate: true);

AssertNotDefault(res.Result.Description.Order);
Expand Down
2 changes: 2 additions & 0 deletions tests/KrakenClient.PublicApi.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ public async Task GetOhlcData()
[Fact]
public async Task GetOrderBook()
{
// Note, this can fail if the order book does not have any ask or bid orders for the pair.

var res = await Client.GetOrderBook(DefaultPair);

var orderBook = res.Result.First();
Expand Down

0 comments on commit 6147afa

Please sign in to comment.