0

I use Rest Assured framework (Java).

I need to send integer array as http-param in get request: http://example.com:8080/myservice?data_ids=11,22,33

    Integer[] ids = new Integer[] {11, 22, 33};

    ...

    RequestSpecificationImpl request = (RequestSpecificationImpl)RestAssured.given();
    request.baseUri("http://example.com");
    request.port(8080);
    request.basePath("/myservice");

    ...

    String ids_as_string = Arrays.toString(ids).replaceAll("\\s|[\\[]|[]]", "");
    request.params("data_ids", ids_as_string);

    System.out.println("Params: " + request.getRequestParams().toString());
    System.out.println("URI" + request.getURI());

What I see in the console:

Params: {data_ids=11,22,33}
URI: http://example.com:8080/myservice?data_ids=11%2C22%2C33

Why do my commas transform into '%2C'?

What needs to be done to ensure that commas are passed as they should?

0

1 Answer 1

1

Disable URL encoding, simple as that

given().urlEncodingEnabled(false);

Official documentation

Verified locally,

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.