Hi,
I’m trying to write a test which posts either string data or binary data to a url. If it’s string data I can use the feeder mechanism to replace some variables in the string.
This is what I’m trying to do
var body = StringBody("")
if (dataFormat == “a”) {
body = ByteArrayBody(someBytes)
} else {
body = StringBody(message)
}
val testHttp = http(“request_1”).post(messagesPath).header(contentType, headerJson).body(body)
But it fails because body has already been declared as one type and later I set it to another.
In Java I would just declare body as whatever the superclass of StringBody and ByteArrayBody is.
How do I do that in gatling?
Is there an API doc for StringBody and ByteArrayBody, and for the body() method? I haven’t been able to find it if there is.