ajoseph
ajoseph

Reputation: 45

Karate support for validating pipe separated response and avro format

We have webservice where we send the request body as binary (avro format) through postman and have a pipe separated response. We were able send this request using karate and get a valid response but made observation that by default karate sets the content type as ‘application/octect-stream’ where as we expect content type to be application/json. Is there a reason why karate uses application/octect-stream for avro format?

Also for pipe separated response does karate support any default validations similar to json/xml validations?

For e.g : if the sample response is like

|PDT|! PRODUCT!|Item1|!SKUID!|sku123a|!DETAILS!|Itemname|itemnumber|price|!FINISH!|

Upvotes: 1

Views: 245

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58088

Karate tries to guess the content-type but clearly needs help here, please refer to the documentation for the header keyword, and you can set (over-ride) it easily: https://github.com/intuit/karate#header

For the second question, I suggest you write a simple utility to convert that response to JSON and then you will be able to do all kinds of awesome validations in Karate. This example should be self-explanatory: dogs.feature

Upvotes: 1

Related Questions