Skip to content

Commit

Permalink
Including the raw query string in the HTTP request.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmihajlovski committed Dec 13, 2015
1 parent c88c2b6 commit 1cf06b0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
4 changes: 4 additions & 0 deletions rapidoid-ctx/src/main/java/org/rapidoid/http/Req.java
Expand Up @@ -45,6 +45,10 @@ public interface Req {

Req path(String path);

String query();

Req query(String query);

byte[] body();

Req body(byte[] body);
Expand Down
Expand Up @@ -260,10 +260,11 @@ public void process(Channel channel) {
String verb = xverb.str(buf);
String uri = xuri.str(buf);
String path = UTILS.urlDecode(xpath.str(buf));
String query = UTILS.urlDecode(xquery.str(buf));

MediaType contentType = handler != null ? handler.contentType() : MediaType.HTML_UTF_8;

req = new ReqImpl(this, channel, isKeepAlive.value, verb, uri, path, body, params, headers, cookies,
req = new ReqImpl(this, channel, isKeepAlive.value, verb, uri, path, query, body, params, headers, cookies,
posted, files, contentType);
}

Expand Down
Expand Up @@ -54,6 +54,8 @@ public class ReqImpl implements Req, Constants {

private volatile String path;

private volatile String query;

private volatile byte[] body;

private final Map<String, String> params;
Expand Down Expand Up @@ -83,15 +85,17 @@ public class ReqImpl implements Req, Constants {
private final MediaType defaultContentType;

public ReqImpl(FastHttp http, Channel channel, boolean isKeepAlive, String verb, String uri, String path,
byte[] body, Map<String, String> params, Map<String, String> headers, Map<String, String> cookies,
Map<String, Object> posted, Map<String, byte[]> files, MediaType defaultContentType) {
String query, byte[] body, Map<String, String> params, Map<String, String> headers,
Map<String, String> cookies, Map<String, Object> posted, Map<String, byte[]> files,
MediaType defaultContentType) {

this.http = http;
this.channel = channel;
this.isKeepAlive = isKeepAlive;
this.verb = verb;
this.uri = uri;
this.path = path;
this.query = query;
this.body = body;
this.params = params;
this.headers = headers;
Expand Down Expand Up @@ -134,6 +138,17 @@ public Req path(String path) {
return this;
}

@Override
public String query() {
return query;
}

@Override
public Req query(String query) {
this.query = query;
return this;
}

@Override
public byte[] body() {
return body;
Expand Down

0 comments on commit 1cf06b0

Please sign in to comment.