Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.apache.http.util.EntityUtils;
import org.elasticsearch.client.Response;
import org.elasticsearch.client.ResponseException;
import org.elasticsearch.test.rest.ESRestTestCase;

import java.util.Arrays;
import java.util.List;
Expand All @@ -35,7 +36,7 @@
* methods on REST endpoints should respond with status code 405</a> for more
* information.
*/
public class RestHttpResponseHeadersIT extends HttpSmokeTestCase {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know HttpSmokeTestCase existed! Woah!

public class RestHttpResponseHeadersIT extends ESRestTestCase {

/**
* For an OPTIONS request to a valid REST endpoint, verify that a 200 HTTP
Expand All @@ -45,7 +46,7 @@ public class RestHttpResponseHeadersIT extends HttpSmokeTestCase {
* - Options</a>).
*/
public void testValidEndpointOptionsResponseHttpHeader() throws Exception {
Response response = getRestClient().performRequest("OPTIONS", "/_tasks");
Response response = client().performRequest("OPTIONS", "/_tasks");
assertThat(response.getStatusLine().getStatusCode(), is(200));
assertThat(response.getHeader("Allow"), notNullValue());
List<String> responseAllowHeaderStringArray =
Expand All @@ -63,7 +64,7 @@ public void testValidEndpointOptionsResponseHttpHeader() throws Exception {
*/
public void testUnsupportedMethodResponseHttpHeader() throws Exception {
try {
getRestClient().performRequest("DELETE", "/_tasks");
client().performRequest("DELETE", "/_tasks");
fail("Request should have failed with 405 error");
} catch (ResponseException e) {
Response response = e.getResponse();
Expand All @@ -84,9 +85,9 @@ public void testUnsupportedMethodResponseHttpHeader() throws Exception {
* 17853</a> for more information).
*/
public void testIndexSettingsPostRequest() throws Exception {
client().performRequest("PUT", "/testindex");
try {
createIndex("testindex");
getRestClient().performRequest("POST", "/testindex/_settings");
client().performRequest("POST", "/testindex/_settings");
fail("Request should have failed with 405 error");
} catch (ResponseException e) {
Response response = e.getResponse();
Expand Down