diff options
3 files changed, 27 insertions, 3 deletions
diff --git a/modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpRequest.java b/modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpRequest.java index 5194c762b7..2ce6ffada6 100644 --- a/modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpRequest.java +++ b/modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpRequest.java @@ -119,7 +119,19 @@ public class Netty4HttpRequest extends RestRequest { return Method.OPTIONS; } - return Method.GET; + if (httpMethod == HttpMethod.PATCH) { + return Method.PATCH; + } + + if (httpMethod == HttpMethod.TRACE) { + return Method.TRACE; + } + + if (httpMethod == HttpMethod.CONNECT) { + return Method.CONNECT; + } + + throw new IllegalArgumentException("Unexpected http method: " + httpMethod); } @Override diff --git a/plugins/transport-nio/src/main/java/org/elasticsearch/http/nio/NioHttpRequest.java b/plugins/transport-nio/src/main/java/org/elasticsearch/http/nio/NioHttpRequest.java index b5bfcc6b0c..4dcd6ba19e 100644 --- a/plugins/transport-nio/src/main/java/org/elasticsearch/http/nio/NioHttpRequest.java +++ b/plugins/transport-nio/src/main/java/org/elasticsearch/http/nio/NioHttpRequest.java @@ -84,7 +84,19 @@ public class NioHttpRequest extends RestRequest { return Method.OPTIONS; } - return Method.GET; + if (httpMethod == HttpMethod.PATCH) { + return Method.PATCH; + } + + if (httpMethod == HttpMethod.TRACE) { + return Method.TRACE; + } + + if (httpMethod == HttpMethod.CONNECT) { + return Method.CONNECT; + } + + throw new IllegalArgumentException("Unexpected http method: " + httpMethod); } @Override diff --git a/server/src/main/java/org/elasticsearch/rest/RestRequest.java b/server/src/main/java/org/elasticsearch/rest/RestRequest.java index bd46a20f31..65b4f9d1d3 100644 --- a/server/src/main/java/org/elasticsearch/rest/RestRequest.java +++ b/server/src/main/java/org/elasticsearch/rest/RestRequest.java @@ -130,7 +130,7 @@ public abstract class RestRequest implements ToXContent.Params { } public enum Method { - GET, POST, PUT, DELETE, OPTIONS, HEAD + GET, POST, PUT, DELETE, OPTIONS, HEAD, PATCH, TRACE, CONNECT } public abstract Method method(); |