简体   繁体   English

Gatling scala:检查状态码是否属于列表

[英]Gatling scala: Check that the status code belongs to a list

For a scenario I want to check that status code of the response belongs to 200-209 or 304 or 404.对于一个场景,我想检查响应的状态代码是否属于 200-209 或 304 或 404。

I tried the following but apparently it's not supported.我尝试了以下方法,但显然不支持。 And I can't find my use case in the docs .而且我在 文档中找不到我的用例。

scenario("Scenario example").exec(httpRequest
    .check(status.in(200 to 209, 304, 404)))

Is there a better solution other than listing the codes manually?除了手动列出代码之外,还有更好的解决方案吗?

    .check(status.in(200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 304, 404))
status.in((200 to 209) ++ List(304, 404))

You passed something mixed with Seq and Int .你传递了一些混合了SeqInt的东西。

The method in takes Seq[Int] :中的方法in Seq[Int]

.check(
      status.in((201 to 209) :+ 303 :+ 304)
    )

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

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