空手道身份验证仅对场景中的第一个请求有效
Karate Authentication only valid for the first request in scenario
我的问题是我获得了第一个请求(创建文章)的授权,但没有获得第二个请求(getById)的授权,尽管授权本身没有改变。我做错了什么?
Feature: Test Article Endpoint
Background:
* url 'http://localhost:8080/webapp/api/v1'
* header AuthenticationToken = 'sys-test-api-token'
Scenario: create article, get article ById, update article & delete article
And request {name: 'TestArtikel', unitName: 'Stk.', articleNumber: '0001'}
Given path 'article'
When method post
Then status 201
And match response.id == '#notnull'
* def articleId = response.id
Given path 'article/id/:id'
And param id = articleId
When method get
Then status 200
对于“跨度”请求的 headers,请使用 configure headers
:
* configure headers = { AuthenticationToken: 'sys-test-api-token' }
我的问题是我获得了第一个请求(创建文章)的授权,但没有获得第二个请求(getById)的授权,尽管授权本身没有改变。我做错了什么?
Feature: Test Article Endpoint
Background:
* url 'http://localhost:8080/webapp/api/v1'
* header AuthenticationToken = 'sys-test-api-token'
Scenario: create article, get article ById, update article & delete article
And request {name: 'TestArtikel', unitName: 'Stk.', articleNumber: '0001'}
Given path 'article'
When method post
Then status 201
And match response.id == '#notnull'
* def articleId = response.id
Given path 'article/id/:id'
And param id = articleId
When method get
Then status 200
对于“跨度”请求的 headers,请使用 configure headers
:
* configure headers = { AuthenticationToken: 'sys-test-api-token' }