REST 确保查询参数的多个值不起作用

Avi*_*kur 1 java rest-assured

只有计划块会做出响应,但对于productId 过滤器不起作用,请放心。同样是在邮递员工作

放心获得回复的代码

Response response = RestAssured
                .given()
                .baseUri(baseUri)
                .header("content-type", "application/json")
                .cookies("SESSIONID", cookie)
                .get("api/members/"
                        + 1
                        + "/search?expand=plan,product");
Run Code Online (Sandbox Code Playgroud)

Sam*_*lva 5

请像这样给出,它已经过测试并且可以工作,请根据您的 URI 进行修改

@测试(启用=真)

    public  void performMultipleQueryparametrs() {
        RestAssured.baseURI = "https://reqres.in/";
        RestAssured.basePath = "api/";
        given().urlEncodingEnabled(false).contentType(ContentType.JSON). with().queryParam("page", 2).queryParam("id", 9).
        when().get("users").then().statusCode(200).log().all();
    }
Run Code Online (Sandbox Code Playgroud)

  • urlEncodingEnabled(假)。谢谢你。 (2认同)