多行表达式中的变量未解析

Variable in multi-line expression not resolving

我有以下场景,将响应与包含变量的多行表达式相匹配。此变量在 karate-config.js 中定义并存在,因为测试成功到最后一步。

Background:
  Given url $baseUrl

Scenario: Fetch Root
  Given path "/"
  When method GET
  Then status 200
  And match header Content-Type == $halJson
  And match response ==
  """
  {
    "_links": {
      "user": {
        "href": "$baseUrl/user"
      }
    }
  }
  """

如何在 match response 步骤中将 baseUrl 变量替换为实际值?

在同事的帮助下,我找到了一些有用的东西

  And match response ==
  """
  {
    "_links": {
      "fpu": {
        "href": '#(baseUrl + "/fpu")'
      }
    }
  }
  """