1

How do we test a GET call with POST body in its request using karate API.

When trying to provide Request body for Get method in Karate API, it doesn't take the request and throws 400 status code and says expected JSONArray and found Null

Sun09
  • 21
  • 1

1 Answers1

0

A body for a GET is supported in the latest versions. See https://stackoverflow.com/a/55812032/143475

Else your question does not make sense, so please consider this not supported in Karate.

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • I am using the latest karate version mentioned in the docs and here is my request: Scenario: Validate valid get response * url “url" * header Accept = "application/json" * header Content-Type = "application/json" * def requestbody = [“blah”] When request requestbody And header client_id = “xyz" And header client_secret = “abc" And method GET Then status 200 . Could you please let me know if there is something wrong with the request? The failure i get is expected type: JSONArray, found: Null – Sun09 Aug 30 '21 at 17:31
  • @Sun09 as I said, look for another tool please. or contribute code to karate. or prove that this is a bug: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue – Peter Thomas Aug 30 '21 at 17:32