【发布时间】:2022-07-04 23:46:34
【问题描述】:
请放心 - API 如何使用后查询字符串我无法通过这个。我必须手动勾选或取消勾选。
我们需要使用 Post 查询字符串发送数据,而不是从媒体类型发送数据:
response = given()
.header()
.log()
.when()
.post()
.then()
【问题讨论】:
标签: rest-assured
请放心 - API 如何使用后查询字符串我无法通过这个。我必须手动勾选或取消勾选。
我们需要使用 Post 查询字符串发送数据,而不是从媒体类型发送数据:
response = given()
.header()
.log()
.when()
.post()
.then()
【问题讨论】:
标签: rest-assured
只是内容类型application/x-www-form-urlencoded
例如:
given().log().all()
.config(RestAssured.config()
.encoderConfig(encoderConfig().appendDefaultContentCharsetToContentTypeIfUndefined(false)))
.contentType(ContentType.URLENC)
.formParam("name", "john.smith")
.formParam("firstName", "john")
.formParam("lastName", "Smith")
.formParam("email", "js@jscompany.com")
.post("https://postman-echo.com/post")
.prettyPrint();
【讨论】: