2014-06-13 26 views
0

我正在寫一個API的測試,hmacsha1使用密鑰對整個獲取請求查詢字符串進行散列並將其發送到標題中。所以我需要在執行測試之前計算這個值,並將其設置在標題中。像這樣:RestAssured如何在mid語句中訪問查詢參數?

expect() 
     .statusCode(200) 
.given() 
     .parameter("key", "abc") 
     .parameter("param2", "def") 
     .header("Authorization",hmacsha1(queryString,"secretKey")) 
.when() 
     .get("/endpoint"); 

有沒有一種方法可以訪問「queryString」位置的當前查詢字符串?基本上它應該給我「key = abc & param2 = def」,這樣我就可以將它散列到原地。

非常感謝!

回答

0

也許你可以使用filter並在請求發送到服務器之前散列查詢參數?

相關問題