Skip to content

Commit 482f159

Browse files
author
pablo
committed
Sorting query-string params before signing authorization key.
1 parent 1891588 commit 482f159

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

.gitignore

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,4 @@ local.properties
3232
# Intellij
3333
######################
3434
.idea/
35-
*.iml
36-
*.iws
37-
*.ipr
38-
*.ids
39-
*.orig
40-
classes/
35+
*.iml

src/main/java/com/cryptomarket/sdk/HttpClientImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public String get(String endpoint, @Nullable Map<String, String> params) throws
8989
URI uri = null;
9090
try {
9191
URIBuilder uriBuilder = new URIBuilder(this.url + this.apiVersion + endpoint);
92-
if (params != null) params.forEach((key, val) -> uriBuilder.addParameter(key, val));
92+
if (params != null) params.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEach(e -> uriBuilder.addParameter(e.getKey(), e.getValue()));
9393
uri = uriBuilder.build();
9494
} catch (URISyntaxException e) {
9595
throw new CryptomarketSDKException("Failed to build the uri", e);

0 commit comments

Comments
 (0)