空手道API:如何用POST方法命中没有请求体的端点URL [英] Karate API : How to hit an endpoint url with post method which does not have request body

查看:0
本文介绍了空手道API:如何用POST方法命中没有请求体的端点URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用没有正文的POST方法访问终结点URL时,出现以下错误。在邮递员中,我能够用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 ''

这篇关于空手道API:如何用POST方法命中没有请求体的端点URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆