Skip to content

Commit 645f7f5

Browse files
committed
Merge pull request AsyncHttpClient#36 from BluePyth/emptymaps
Handles params & queryParams only if maps are not empty
2 parents 0a09ae7 + 8264af0 commit 645f7f5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/java/com/ning/http/client/RequestBuilderBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ private String toUrl(boolean encode) {
134134
throw new IllegalArgumentException("Illegal URL: " + url, e);
135135
}
136136

137-
if (queryParams != null) {
137+
if (queryParams != null && !queryParams.isEmpty()) {
138138

139139
StringBuilder builder = new StringBuilder();
140140
if (!url.substring(8).contains("/")) { // no other "/" than http[s]:// -> http://localhost:1234

src/main/java/com/ning/http/client/providers/netty/NettyAsyncHttpProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ private static HttpRequest construct(AsyncHttpClientConfig config,
712712
int length = lengthWrapper[0];
713713
nettyRequest.setHeader(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(length));
714714
nettyRequest.setContent(ChannelBuffers.wrappedBuffer(bytes, 0, length));
715-
} else if (request.getParams() != null) {
715+
} else if (request.getParams() != null && !request.getParams().isEmpty()) {
716716
StringBuilder sb = new StringBuilder();
717717
for (final Entry<String, List<String>> paramEntry : request.getParams()) {
718718
final String key = paramEntry.getKey();

0 commit comments

Comments
 (0)