Skip to content

Commit

Permalink
fix wrong handling of empty param in thrift/memcached transport
Browse files Browse the repository at this point in the history
  • Loading branch information
kimchy committed Oct 18, 2010
1 parent 019c844 commit bad45de
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ public void setData(byte[] data) {
@Override public String param(String key, String defaultValue) {
String value = params.get(key);
if (value == null) {
return value;
return defaultValue;
}
return defaultValue;
return value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ public ThriftRestRequest(org.elasticsearch.thrift.RestRequest request) {
@Override public String param(String key, String defaultValue) {
String value = params.get(key);
if (value == null) {
return value;
return defaultValue;
}
return defaultValue;
return value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ public class SimpleThriftTests {
assertThat(map.get("ok").toString(), equalTo("true"));
assertThat(map.get("_index").toString(), equalTo("test"));
assertThat(map.get("_type").toString(), equalTo("type1"));

request = new RestRequest(Method.GET, "/_cluster/health");
response = client.execute(request);
assertThat(response.getStatus(), equalTo(Status.OK));
}

private Map<String, Object> parseBody(RestResponse response) throws IOException {
Expand Down

0 comments on commit bad45de

Please sign in to comment.