Skip to content

Commit

Permalink
Merge pull request #224 from blmarket/fix-url-encoding
Browse files Browse the repository at this point in the history
Fix query and fragment removed from request
  • Loading branch information
trustin authored Aug 11, 2016
2 parents 07e767f + 86a888e commit 9c81fc6
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static com.linecorp.armeria.common.util.Functions.voidFunction;

import java.net.URI;
import java.util.Arrays;

import com.linecorp.armeria.client.ClientOptionValue;
Expand Down Expand Up @@ -47,9 +48,19 @@ public Future<SimpleHttpResponse> execute(SimpleHttpRequest sReq) {
final EventLoop eventLoop = client.eventLoop0();
final Promise<SimpleHttpResponse> promise = eventLoop.newPromise();
try {
URI uri = sReq.uri();
StringBuilder uriBuilder = new StringBuilder(uri.getPath());
if (uri.getQuery() != null) {
uriBuilder.append('?');
uriBuilder.append(uri.getQuery());
}
if (uri.getFragment() != null) {
uriBuilder.append('#');
uriBuilder.append(uri.getFragment());
}
final AggregatedHttpMessage aReq = AggregatedHttpMessage.of(
HttpMethod.valueOf(sReq.method().name()),
sReq.uri().getPath(),
uriBuilder.toString(),
HttpData.of(sReq.content()));

// Convert the headers.
Expand Down

0 comments on commit 9c81fc6

Please sign in to comment.