2017-08-03 53 views
0

我需要从REST API响应和状态代码中获取一些字段。我一次只能得到一个。如何使用Rest Assured一次提取REST API响应和状态代码

Response res = given().header("Content-Type","application/json").body(json).when().post("/rest/auth/1/session").then().extract().response() ; 


Integer stC = given().header("Content-Type","application/json").body(json).when().post("/rest/auth/1/session").then().extract().statusCode() ; 

如何在一个请求中同时获得这两个请求?

回答

0

正如所料,我问了一个愚蠢的问题。

这就是我们如何能够从Response对象得到的一切

res.statusCode() ; 
    res.headers(); 
    res.body() ;