在此处输入图像描述
在此处输入图像描述
在postman中,我能够获得200个状态代码,但是当我尝试使用rest-assured自动化它时,我得到了400个错误。
public class trial {
public static void main(String[] args) {
// TODO Auto-generated method stub
RestAssured.baseURI="https://api.planet.com";
Response res=given().
header("Authorization", "api-key ab2118c30721496495ddc8d4f3603d69").
header("Content-Type", "application/json").
queryParam("strict", "false").
body("{" +
" \"filter\": { " +
" \"type\":\"AndFilter\"," +
" \"config\": [" +
" { " +
" \"type\":\"RangeFilter\"," +
" \"field_name\":\"cloud_cover\"," +
" \"config\":{ " +
" \"lte\":0.5" +
" }" +
" }" +
" ]" +
" " +
"}," +
" \"item_types\": [\"PSScene3Band\"]," +
" \"name\": \"Assignment\"" +
"}").
when().
post("/data/v1/searches/").
then().assertThat().statusCode(200).and().contentType(ContentType.JSON).
extract().response();
JsonPath js=ReusableMethods.rawToJson(res);
System.out.println(res.getBody().asString());
}
}
暂无答案!
目前还没有任何答案,快来回答吧!