mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
Add TRACE, CONNECT, and PATCH http methods (#31035)
This is related to #31017. That issue identified that these three http methods were treated like GET requests. This commit adds them to RestRequest. This means that these methods will be handled properly and generate 405s.
This commit is contained in:
parent
2401150be7
commit
f8785dda9d
@ -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
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user