无法使用空手道验证来自 REST API 的响应 headers

Unable to validate response headers from a REST API using Karate

我有一个简单的 REST API,允许给定端点中的 POST 资源,我想验证响应 headers 是否设置正确。我定义了以下功能,它在数据库中插入了一堆用户:

  Scenario Outline: Creating a bunch of new users when the database is empty
    Given header Content-Type = 'application/json'
    And request __row
    When method post
    Then status 201
    * match header Content-Type == 'application/json'
    * match header Location == 'http://localhost:8080/users/'+response.id

    Examples:
      | users |

用户已正确插入,在控制台中我可以看到以下响应headers:

1 < 201
1 < Connection: keep-alive
1 < Content-Type: application/json
1 < Date: Mon, 22 Feb 2021 14:06:31 GMT
1 < Keep-Alive: timeout=60
1 < Location: http://localhost:8080/users/user1@test.com
1 < Transfer-Encoding: chunked

但是每次我尝试 运行 这个测试时,我都会得到相同的响应:

path: $['Content-Type'][0], actual: null, expected: 'application/json', reason: actual json-path does not exist

适用于 0.9.6

* url 'https://httpbin.org/get'
* method get
* match header Content-Type == 'application/json'

但正如我在评论中提到的,请尝试 1.0 / RC 版本:https://github.com/intuit/karate/wiki/1.0-upgrade-guide

因为我们正在集中精力于此。