使用Rest Assured进行Rest Api测试-不起作用

使用Rest Assured进行Rest Api测试-不起作用,rest,rest-assured,Rest,Rest Assured,我正在使用Rest-Assured进行restapi测试,我已经正确地编码了,但不知道在显示正确的请求时发生了什么,但是在服务器请求中,每个输入参数都显示为null 代码: 如果我做错了,请任何人提供帮助。提供更多信息,您在控制台中遇到了什么错误?响应中出现内部服务器错误与Rest Assured无关,请确保您达到了正确的端点交叉检查端点中的(/)斜线。使用以下行调试rest-assured请求//restasured.given().log().all();我已尝试重新启动。given().l

我正在使用Rest-Assured进行restapi测试,我已经正确地编码了,但不知道在显示正确的请求时发生了什么,但是在服务器请求中,每个输入参数都显示为null

代码:


如果我做错了,请任何人提供帮助。

提供更多信息,您在控制台中遇到了什么错误?响应中出现内部服务器错误与Rest Assured无关,请确保您达到了正确的端点交叉检查端点中的(/)斜线。使用以下行调试rest-assured请求//restasured.given().log().all();我已尝试重新启动。given().log().all();并显示为io.restasured.internal。RequestSpecificationImpl@5aa9e4eb行,我缺少任何代码它只是用于记录,这样您就可以看到幕后发生了什么只要将您的第11行(在您上面发布的代码中)更改为RequestSpecification RequestSpecification=RestAssured.given().log().all();然后仔细检查控制台。谢谢,我将尝试一次。实际上我只使用了您的视频教程代码。谢谢,此解决方案解决了我的问题,非常感谢,并告诉我为什么jsonObject to String();
    // convert body in string
    requestSpecification.body(jsonObject.toString());
    if you have any authorisation header, please add as 
    requestSpecification.header("request_id", "request_id value");
    requestSpecification.header("data2", "data value"); 

and make sure you post URL is currect
    // convert body in string
    requestSpecification.body(jsonObject.toString());
    if you have any authorisation header, please add as 
    requestSpecification.header("request_id", "request_id value");
    requestSpecification.header("data2", "data value"); 

and make sure you post URL is currect