检查 header 是否包含有效的 UUID
Check if a header contains a valid UUID
我正在尝试检查 header 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'
怎样才能做到这一点最'karate way'?
提前致谢!
我认为这是最好的选择:
* def location = responseHeaders['Location'][0]
* def temp = location.substring(location.lastIndexOf('/') + 1)
* match temp == '#uuid'
我正在尝试检查 header 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'
怎样才能做到这一点最'karate way'?
提前致谢!
我认为这是最好的选择:
* def location = responseHeaders['Location'][0]
* def temp = location.substring(location.lastIndexOf('/') + 1)
* match temp == '#uuid'