我正在尝试检查标头Location
是否以有效的UUID结尾。我尝试了以下方法
Scenario: Create an airline
Given path '/somePath'
And request { some: 'request' }
When method post
Then status 201
Then match header Location == '/somePath/#uuid'
我正在考虑创建一个提取UUID的函数,然后尝试match extractedUUID == '#uuid'
如何以最“空手道的方式”实现这一目标?
谢谢!
答案 0 :(得分:3)
我认为这是最好的选择:
* def location = responseHeaders['Location'][0]
* def temp = location.substring(location.lastIndexOf('/') + 1)
* match temp == '#uuid'