我已经成功地在邮递员中尝试过,通过在 x-www-form-urlencoded 正文中添加 Header"Content-Type=application/x-www-form-urlencoded"。显然,这是我第一次在休息时工作。请告诉我,下面我的代码是否正确。谢谢你。
RestAssured.baseURI = AssignConfig.app.getProperty("RestURL");
Response request = RestAssured
.given()
.config(RestAssured.config()
.encoderConfig(EncoderConfig.encoderConfig()
.encodeContentTypeAs("x-www-form-urlencoded", ContentType.URLENC)))
.contentType("application/x-www-form-urlencoded; charset=UTF-8")
.header("Content-Type", "application/x-www-form-urlencoded")
.formParam("login","userName")
.formParam("password","password")