add content type
This commit is contained in:
parent
f2b75de3f6
commit
0136987299
3 changed files with 12 additions and 11 deletions
|
@ -175,13 +175,13 @@ public class CrawlTestBase extends ITBase {
|
|||
}
|
||||
|
||||
protected static Response deleteMethod(final String path) {
|
||||
return given().header("Authorization", getTestToken()).delete(path);
|
||||
return given().contentType("application/json").header("Authorization", getTestToken()).delete(path);
|
||||
}
|
||||
|
||||
protected static void deleteDocuments(final String queryString) {
|
||||
List<String> docIds = new ArrayList<>();
|
||||
Response response =
|
||||
given().param("scroll", "1m").param("q", queryString)
|
||||
given().contentType("application/json").param("scroll", "1m").param("q", queryString)
|
||||
.get(getEsUrl() + "/" + DOC_INDEX_NAME + "/" + DOC_TYPE_NAME + "/_search");
|
||||
JsonPath jsonPath = JsonPath.from(response.asString());
|
||||
String scrollId = jsonPath.getString("_scroll_id");
|
||||
|
@ -194,12 +194,12 @@ public class CrawlTestBase extends ITBase {
|
|||
Map<String, Object> scrollBody = new HashMap<>();
|
||||
scrollBody.put("scroll", "1m");
|
||||
scrollBody.put("scroll_id", scrollId);
|
||||
response = given().body(scrollBody).get(getEsUrl() + "/_search/scroll");
|
||||
response = given().contentType("application/json").body(scrollBody).get(getEsUrl() + "/_search/scroll");
|
||||
jsonPath = JsonPath.from(response.asString());
|
||||
}
|
||||
|
||||
for (String docId : docIds) {
|
||||
given().delete(getEsUrl() + "/" + DOC_INDEX_NAME + "/" + DOC_TYPE_NAME + "/" + docId);
|
||||
given().contentType("application/json").delete(getEsUrl() + "/" + DOC_INDEX_NAME + "/" + DOC_TYPE_NAME + "/" + docId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ public abstract class CrudTestBase extends ITBase {
|
|||
}
|
||||
|
||||
protected Response checkDeleteMethod(final String path) {
|
||||
return given().header("Authorization", getTestToken()).delete(getApiPath() + "/" + path);
|
||||
return given().contentType("application/json").header("Authorization", getTestToken()).delete(getApiPath() + "/" + path);
|
||||
}
|
||||
|
||||
protected List<Map<String, Object>> getItemList(final Map<String, Object> body) {
|
||||
|
|
|
@ -38,12 +38,12 @@ public class ITBase {
|
|||
return testToken;
|
||||
}
|
||||
|
||||
given().body(
|
||||
"{\"index\":{\"_index\":\".fess_config.access_token\",\"_type\":\"access_token\",\"_id\":\""
|
||||
given().contentType("application/json")
|
||||
.body("{\"index\":{\"_index\":\".fess_config.access_token\",\"_type\":\"access_token\",\"_id\":\""
|
||||
+ DEFAULT_TEST_TOKEN_ID
|
||||
+ "\"}}\n{\"updatedTime\":1490250145200,\"updatedBy\":\"admin\",\"createdBy\":\"admin\",\"permissions\":[\"Radmin-api\"],\"name\":\"Admin API\",\"createdTime\":1490250145200,\"token\":\""
|
||||
+ DEFAULT_TEST_TOKEN + "\"}\n").when().post(getEsUrl() + "/_bulk");
|
||||
given().when().post(getEsUrl() + "/_refresh");
|
||||
given().contentType("application/json").when().post(getEsUrl() + "/_refresh");
|
||||
return DEFAULT_TEST_TOKEN;
|
||||
}
|
||||
|
||||
|
@ -52,11 +52,11 @@ public class ITBase {
|
|||
if (testToken != null) {
|
||||
return;
|
||||
}
|
||||
given().delete(getEsUrl() + "/.fess_config.access_token/access_token/" + DEFAULT_TEST_TOKEN_ID);
|
||||
given().contentType("application/json").delete(getEsUrl() + "/.fess_config.access_token/access_token/" + DEFAULT_TEST_TOKEN_ID);
|
||||
}
|
||||
|
||||
public static void refresh() {
|
||||
given().post(getEsUrl() + "/_refresh");
|
||||
given().contentType("application/json").post(getEsUrl() + "/_refresh");
|
||||
}
|
||||
|
||||
public static String getFessUrl() {
|
||||
|
@ -68,6 +68,7 @@ public class ITBase {
|
|||
}
|
||||
|
||||
protected static RequestSpecification checkMethodBase(final Map<String, Object> body) {
|
||||
return given().header("Authorization", getTestToken()).body(body, ObjectMapperType.JACKSON_2).when();
|
||||
return given().contentType("application/json").header("Authorization", getTestToken()).body(body, ObjectMapperType.JACKSON_2)
|
||||
.when();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue