swapna
swapna

Reputation: 213

Request mandatory for POST method call in Karate

Today I came across a scenario where there was a POST method call but that does not require a request data and query parameters are sufficient. But in Karate framework it is mandatory to give request data when it is POST method. So I had to provide request as 'null' explicitly. Is there any way in Karate that if there is no request data then you can skip providing request data as 'null'.

Upvotes: 2

Views: 2486

Answers (2)

swapna
swapna

Reputation: 213

I tried this way:

Given url 'url'
And params param_value
And request '{}'
When method post
Then status 200

Its same as mentioned above just I gave empty request body

Upvotes: 1

Ciara Brennan
Ciara Brennan

Reputation: 66

This is what I usually do if there's no request body :

Given path '/path/to//action'
And request ''
When method post
Then status 200

(Haven't found a way to skip the request step)

Upvotes: 4

Related Questions