2017-08-03 51 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() ;