在Gatling中使用basicAuth发出Gatling Post请求

问题描述 投票:0回答:1

在我的加特林测试中,我有此测试:

  val HorizonPost: ChainBuilder = exec(
    http("Horizon Post")
      .post(getRouteInfoURI).basicAuth(s"${{EnvValues.RoadsApi_Username}}", s"${{EnvValues.RoadsApi_Password}}")
      .body(ElFileBody("bodies/horizonPost.json")).asJson
      .check(status.is(200))
  )

似乎'current_timestamp'有问题,并出现此错误:

    body=
The request content was malformed:
Text '{{$current_timestamp}}' could not be parsed at index 0

有人可以解释我需要更改的内容吗?我对加特林还比较陌生。

json scala gatling
1个回答
0
投票

如果您尝试使用Scala string interpolation,则正确的语法是s"${foo}",而不是s"${{foo}}"

[如果您尝试使用Gatling Expression Language,则正确的语法是"${foo}"(没有s),而不是s"${{foo}}"

© www.soinside.com 2019 - 2024. All rights reserved.