我正在使用宁静放心框架,我执行以下步骤。
1)使用 GET 请求能够获取响应标头中的 CSRF 令牌。
2)然后我尝试使用相同的获取的 CSRF 令牌来发布另一个请求,我收到“CSRF 令牌验证失败”
response = RestAssured.given()
.when ()
.contentType (ContentType.JSON)
.queryParam("$top", "10&$filter=ContactID eq 'LZebLLUr590jmVsgpILwAQevxhhHdfjkhdkfjbnkdf' & ContactOrigin='XXXX'&$format=json")
.header("Authorization","Bearer"+" "+SapLoginAPISteps.authToken)
.header("x-csrf-token",SapGetCsrfTokensApiSteps.csrfToken)
.header("Connection",SapGetCsrfTokensApiSteps.Connection)
.header("set-cookie",SapGetCsrfTokensApiSteps.cookie)
.get();