简体   繁体   中英

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.

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 .

The method in takes Seq[Int] :

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

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