简体   繁体   中英

Gatling: check binary response not empty

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?

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM