java - 在 Postman 中获取 200 个代码,但在通过放心自动执行相同请求时获取 400 个代码
问题描述
在邮递员中,我可以获得 200 个状态代码,但是当我尝试使用放心自动化它时,我收到 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());
}
}
解决方案
推荐阅读
- java - ConfigFileApplicationListener 已弃用,只能用作 EnvironmentPostProcessor
- python - 如何仅通过加入和离开使这些频道动态可见?
- java - Android 动态点播功能问题与 coreLibraryDesugaringEnabled
- html - 以角度访问表格元素的索引值
- ruby-on-rails - 使用 FriendlyID 获取 rails 测试以反映实际行为
- regex - Powershell 函数返回中间值
- sql - 在查询中创建要加入的浮动表
- python - 在plotly python中处理多个x轴的重叠
- php - PHP switch case - 根据下拉菜单中的选定选项使用 file_get_contents()
- python - 使用for循环python列出索引