空手道 API:如何使用没有请求正文的 post 方法命中端点 url

Karate API : How to hit an endpoint url with post method which does not have request body

当我尝试使用没有正文的 post 方法命中端点 url 时,出现以下错误。在 postman 中,我可以在没有正文的情况下使用 post 方法到达端点 url。我通过参考空手道 API 文档尝试了所有步骤。

 **Error** : com.intuit.karate.exception.KarateException: TestScenarios.feature:56 - 
request  body is required for a POST, please use the 'request' keyword

测试url 是:

 **test-api.test.com/test-com/api/check/initiate? 
lang=en&cntCode=us&id=8d1b9355**

尝试 1:

Given url 'test-api.test.com/test-com/api/check/initiate?lang=en&cntCode=us&id=8d1b9355'
When method post
Then status 200
* print  response

尝试 2:

Given url testurl
And param lang= en
And param cCode = us
And param id= '8d1b9355'
When method post
* print 'Response'+response

尝试 3:

Given url testurl
And form field lang= en
And form field cCode = us
When method post
Then status 200

有人可以帮助我理解我的方法中的问题和错误。

两个可能的选项取决于您的服务器:

* request {}

as per the docs:

* request ''