1
votes

I'm doing some tests with Gatling using Scala. I'm trying to check whether a response body that is returned is not empty.

I'm doing it like this:

def getImages: ChainBuilder = feed(credentials)
     .exec(http("Get Image")
     .get(GET_MY_URI)
     .queryParam("guid", "${branch}")
     .queryParam("t", "0.458654")
     .check(status.is(200))
     .check(bodyString.transform(_.size > 1).is(true)))

But it's not working. I get:

java.nio.charset.MalformedInputException: Input length = 1

Does somebody know how to achieve what I'm trying?

1

1 Answers

4
votes

Replace

.check(bodyString.transform(_.size > 1).is(true))) 

with

.check(bodyBytes.exists)

All the DSL is explained here: https://gatling.io/docs/current/cheat-sheet/