chitamoor / Rester

Testing RESTful APIs
MIT License
85 stars 34 forks source link

How to configure Combination condition #22

Open kaorunix opened 8 years ago

kaorunix commented 8 years ago

I am beginner Python and just started to use Rester. How can I configure combination conditions? in json file, like

"number":1,
"number":"Integer",
chitamoor commented 8 years ago

If you strictly want to evaluate a set of conditions, you can simply set the constraints in the payload e.g.

"payload": { "number":1, "number":"Integer" }

Alternatively, you could use the "exec" directive, which is supposed to eval a python expression, but I don't think it will work for the specific condition that you have mentioned -

but here's an example (it's in the documentation) of how you can use the "exec" directive -

"payload":{ "parent.child.message":"exec len(value) > 7 and value.endswith('world')", }