Avinash Thakur
Avinash Thakur

Reputation: 81

REST Assured Multiple values for query param not working

only plan block is coming in response but for productId filter not working in Rest assured. The same is working in postman

Code to get response rest assured

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

Upvotes: 1

Views: 2340

Answers (1)

Sameera De Silva
Sameera De Silva

Reputation: 1980

Please give like this , It's tested and working and kindly amend as per your URI

@Test(enabled=true)

    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();
    }

Upvotes: 5

Related Questions