执行任何请求,我需要执行身份验证POST
请求正文{username:"somename", password:"somepass"}
,
标头Content-Type:application.json
这给了我一个带有生成令牌的响应,我需要将其粘贴为第二个标头,就像Authorization:generated-tokenkjhsdkjfvjbwjbQ==
如有进一步要求。
请你帮我一下好吗?
对我有用的变体:
String token = given()
.contentType("application/json")
.body(new User("someuser" , "123"))
.when()
.post(RestConfig.baseUrl+"/authentication-url")
.then().extract().response().as(TokenResponse.class).getToken();
given()
.contentType("application/json")
.header("Authorization", token)
.get(RestConfig.baseUrl+"/some-path")
.then()
.statusCode(200)...
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)