API如何使用后Querystring

发布于 2025-01-19 20:49:55 字数 307 浏览 0 评论 0原文

请放心-API如何使用后查询字符串我无法通过这个。我必须手动选中或取消选中。

相反,我们需要使用 Post 查询字符串发送数据:

 response = given()
.header()
.log()
.when()
.post()
.then() 

在此处输入图像描述

Rest assured - API how to use post query string I am unable to pass this. I have to check or uncheck manually.

Instead send data from media type we need to send data with Post query string:

 response = given()
.header()
.log()
.when()
.post()
.then() 

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深爱不及久伴 2025-01-26 20:49:55

只是content-type 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", "[email protected]")
      .post("https://postman-echo.com/post")
      .prettyPrint();

It's just content-type application/x-www-form-urlencoded

For example:

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", "[email protected]")
      .post("https://postman-echo.com/post")
      .prettyPrint();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文