Create a http URL with param feeder from Json file

Gatling version: 3.11.2
Gatling flavor: java
Gatling build tool: maven

Hello,
I post a new Topic :slight_smile:

I want to create a HTTP request, this URL :

I put the millistone & state param in json file, but after execution I got a wrong URL :

/issues?milestone=%24%7Bmilestone%7D&q=

Code source of my Gatling simutation :

public class MyGatlingSimulation extends Simulation {

        String baseURL = "https://github.com/gatling/gatling/issues"; 

        // Define your HTTP protocol configuration
        HttpProtocolBuilder httpProtocol = http
                .baseUrl(baseURL)
                .userAgentHeader("Gatling");

        // Define your JSON feeder
        FeederBuilder<Object> feeder = jsonFile("data/data.json").circular();

        // Define your scenario
        ScenarioBuilder scenario = scenario("My Scenario")
                .feed(feeder)
                // Feed the JSON data to the request
                .exec(http("GET Request")

                        .get("/")
                        // Concatenate the base URL with params
                      .queryParam("milestone", "${milestone}")
                      .queryParam("state", "${state}")
                        )
                .exec(session -> {
                    System.out.println("SESSION : "+session.toString());
                    return session;
                }); // Check if response status is 200

        // Define your simulation setup


    {

        setUp(
                scenario.injectOpen(
                        constantUsersPerSec(1).during(1) 
                )
        ).protocols(httpProtocol);
    }
}

The JSON file :

[
  {
    "milestone":1,
    "state": "open"
  }
]

My question: how can I put all the fields of the JSON file in the URL parameters ?

Thanks in advance

Please have a look at the Gatling 3.11 release note: Gatling upgrade from 3.10 to 3.11

Thanks slandelle :slight_smile:

I replaced โ€œ$โ€ by โ€œ#โ€ in the queryParam() and it works

Exactly :clap:

This is the correct syntax nowadays.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.