Skip to content

Commit

Permalink
Accept the same boolean values in RestRequest
Browse files Browse the repository at this point in the history
Added `no` as a possible value to `paramBooleanAsOptional`, also reused existing code from `Booleans.parseBoolean`

Closes #4808
  • Loading branch information
javanna committed Jan 20, 2014
1 parent 7129b9e commit 32428bf
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/main/java/org/elasticsearch/rest/RestRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,7 @@ public boolean paramAsBoolean(String key, boolean defaultValue) {

@Override
public Boolean paramAsBooleanOptional(String key, Boolean defaultValue) {
String sValue = param(key);
if (sValue == null) {
return defaultValue;
}
return !(sValue.equals("false") || sValue.equals("0") || sValue.equals("off"));
return Booleans.parseBoolean(param(key), defaultValue);
}

public TimeValue paramAsTime(String key, TimeValue defaultValue) {
Expand Down

0 comments on commit 32428bf

Please sign in to comment.