How to upload image file in post request and parameterize it in scala

Hi,

We have a post request of uploading an image file in scala:

http(“request_30”)
.post(uri07)
.headers(headers_30)
.body(RawFileBody(“ProjectName/0030_request.json”)),

0030_request.json file contains:

----dio-boundary-0790601138
content-disposition: form-data; name=“preset”

caa_student_id_proof
----dio-boundary-0790601138
content-disposition: form-data; name=“appName”

caa
----dio-boundary-0790601138
content-disposition: form-data; name=“assets”; filename=“student_id_proof”
content-type: image/jpeg/image

ÿØÿà JFIF H H ÿá

while executing the test, we are getting error: status.find.in([200, 209], 304), found 502

Please help us to upload image file in the request and let us know how to parameterize the file in case of multiple images.

This doesn’t make sense.
Why do you have a JSON file that doesn’t contain JSON but a multipart?
How did you record this? Which version of Gatling are you using?

We have converted har file into Scala. By default it’s coming as a multipart maybe because it’s a request where we are uploading a JPEG file.
We are using Gatling version 3.7.5

Could you please share your HAR file? I’d like to understand why the body came as 0030_request**.json**.

Then, the Recorder doesn’t handle multipart for now. You ave to convert to proper multipart, see doc:

We are able to do so in jmeter but not in Gatling
Please refer below the snapshot of jmeter:

In my previous message, I’ve sent you all the related documentation, please read it.