support missing OPTIONS method, it is supported in elasticsearch core
This commit is contained in:
parent
9a38d81bec
commit
6d3f6c7faf
|
@ -27,6 +27,7 @@ import org.apache.http.client.config.RequestConfig;
|
||||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
|
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
|
||||||
import org.apache.http.client.methods.HttpHead;
|
import org.apache.http.client.methods.HttpHead;
|
||||||
|
import org.apache.http.client.methods.HttpOptions;
|
||||||
import org.apache.http.client.methods.HttpPost;
|
import org.apache.http.client.methods.HttpPost;
|
||||||
import org.apache.http.client.methods.HttpPut;
|
import org.apache.http.client.methods.HttpPut;
|
||||||
import org.apache.http.client.methods.HttpRequestBase;
|
import org.apache.http.client.methods.HttpRequestBase;
|
||||||
|
@ -229,6 +230,11 @@ public final class RestClient implements Closeable {
|
||||||
throw new UnsupportedOperationException("HEAD with body is not supported");
|
throw new UnsupportedOperationException("HEAD with body is not supported");
|
||||||
}
|
}
|
||||||
return new HttpHead(uri);
|
return new HttpHead(uri);
|
||||||
|
case HttpOptions.METHOD_NAME:
|
||||||
|
if (entity != null) {
|
||||||
|
throw new UnsupportedOperationException("OPTIONS with body is not supported");
|
||||||
|
}
|
||||||
|
return new HttpOptions(uri);
|
||||||
case HttpPost.METHOD_NAME:
|
case HttpPost.METHOD_NAME:
|
||||||
HttpPost httpPost = new HttpPost(uri);
|
HttpPost httpPost = new HttpPost(uri);
|
||||||
addRequestBody(httpPost, entity);
|
addRequestBody(httpPost, entity);
|
||||||
|
|
Loading…
Reference in New Issue