0

How to provide request body for GET method using Karate API.

When trying to provide Request body for Get method in Karate API, it doesnt take the request and throws 500 status code.

1 Answers1

1

As stated in HTTP GET with request body using the request body within a GET request to change the semantics of the request is highly discouraged.

It's debatable that Karate ignores the message body when using method GET and if you think there is a use case for that feature your free to file an issue.

Furthermore, the 500 status code you observe is returned by your system under test because of the missing message body and has nothing to do with karate.

EDIT: confirmed that Karate 1.0 will support a body along with a GET

Peter Thomas
  • 40,008
  • 10
  • 46
  • 142
Peter
  • 4,039
  • 1
  • 16
  • 27
  • yeah. anyone is free to open a feature request - but we'd expect a code contrib for this - I have a feeling this may not be supported by even the apache / jersey clients we use. worth nothing that this is the first time in 2 years that we got such a request – Peter Thomas Apr 23 '19 at 13:20
  • [Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/guide/current/_empty_search.html) is widely used product that uses the message body in combination with GET request. So, there may be a use case to not ignore the message body. – Peter Apr 23 '19 at 13:21