我已经成功地在邮递员中尝试过,通过将标头“ Content-Type =应用程序/ x-www-form-urlencoded”与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")