Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to put in a param even if the value of param is null

Tags:

karate

so my code is as follows:

* def value = newMP.response.data[randomizer].phoneNumber
* def nullvalue = 'null'
* def filter = (value == '#null' ? nullvalue : value)
* print filter
And param filter[phoneNumber] = filter

The result of this code is enter image description here

Thing is that my application allows a search for null as well. therefore im looking if its possible to put in a filter that is null based on the conditional logic

Additionally if i go like this

And param filter[phoneNumber] = 'null'

the null value is in the GET call

like image 894
Jawad Kalia Avatar asked Sep 19 '25 04:09

Jawad Kalia


1 Answers

Yes by default Karate ignores null-valued params and this is what most users expect.

You have not been clear as to what you are expecting but I'm guessing you need a param with an empty value.

Try this:

And param filter = ''

Also read this example for more ideas: https://github.com/intuit/karate/blob/master/karate-demo/src/test/java/demo/search/dynamic-params.feature

like image 170
Peter Thomas Avatar answered Sep 20 '25 18:09

Peter Thomas