通过放心发布申请/ x-www-form-urlencoded请求

时间:2018-12-18 00:32:09

标签: java rest api rest-assured rest-assured-jsonpath

我已经成功地在邮递员中尝试过,通过将标头“ 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")

0 个答案:

没有答案