简体   繁体   English

加特林:检查二进制响应不为空

[英]Gatling: check binary response not empty

I'm doing some tests with Gatling using Scala. 我正在使用Scala使用Gatling进行一些测试。 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/ 此处解释了所有DSL: https//gatling.io/docs/current/cheat-sheet/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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