theiniel
theiniel

Reputation: 11

problem to validate schema with "#number" to a real number

problem:

$ | not equal | match failed for name: 'httpCode' (MAP:MAP)

$.httpCode | data types don't match (STRING:NUMBER) '#number' 206

schema:

response

{"httpCode":206,"httpMessage":"PARTIAL_CONTENT",

how to validate schema with "#number"??

Upvotes: 1

Views: 185

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58058

It is clear from the error message that the 206 in your actual response JSON is a string, not a number. If you are right, there is a serious bug in Karate, so please follow this process: https://github.com/karatelabs/karate/wiki/How-to-Submit-an-Issue

More likely though, your question is incomplete.

To prove Karate behavior, try this simple test:

* def response = { httpCode: 206 }
* match response == { httpCode: '#number' }

You can change 206 to '206' and see the difference.

Upvotes: 1

Related Questions