Sending multiple request body from dir

Hi,

My resources folder has json files like below

  • A.json. (very large json file) All json have same formats of data
    -B.json
    -C.json

Now I need to read these files and send them as request body in post AP call.
How to write galing script for this.

I have written val fileNames = Iterator(“A.json”, “B.json”, “C.json”)
exec({
val name = fileNames.next()
System.out.println("***************"+name)
http(name)
.post("/shift/request/123")
.body(RawFileBody(name)).asJson
.check(status.is(200))
})

but it is picking only first file always. And I have many concurretn users too.
In tutorial also I have seen using one json and adding all to it and using feeder but in my case I need those individual jsons in different fills.

Thanks in advance,

You should use a foreach loop:

In Java:

foreach(Arrays.asList(“A.json”, “B.json”, “C.json”), “body”).on(
exec(
http("#{elt}")
.post("/shift/request/123")
.body(RawFileBody("#{elt}"))
.asJson
.check(status.is(200))
)
);