尝试点击发布请求时出现 500 内部服务器错误

问题描述 投票:0回答:1

我正在尝试点击 post 请求,但收到 500 内部服务器错误。但是在邮递员中可以看到 200 条成功的消息。 @Given("选择 POST 请求") 公共无效 select_POST_request() {RestAssured.baseURI =“https://restful-booker.herokuapp.com/booking”; HashMap head=new HashMap();head.put("Content-Type", "text/xml");head.put("接受", "/"); head.put("连接", "保持活动");head.put("接受编码", "gzip, deflate, br");
响应 resp= RestAssured.given().log().all().headers(head).body(body).relaxedHTTPSValidation().when().post();System.out.println(resp); System.out.println(resp.asPrettyString());System.out.println(resp.getStatusCode()); Assert.assertEquals(resp.getStatusCode(), "200");

java automation postman rest-assured
1个回答
0
投票

您应该确保您在请求中提供的内容与邮递员收藏中的内容相同。您的示例中未定义变量

body
。难道是序列化不正确?还有其他一些属性没有被后端服务忽略或者没有必需的吗?

© www.soinside.com 2019 - 2024. All rights reserved.