Status & Body regex test or match supported #1592
Unanswered
scottstark
asked this question in
Help
Replies: 1 comment
-
You usually want to create multiple responses with rules, or deal with this kind of validation in the template. But templates do not communicate with the rules (but maybe I misunderstood what you are trying to do). A typical setup is usually the following:
I suggest you read the docs and this tutorial to understand how rules work. You can perfectly have one response and customize it with a template, but it's probably a bit more complicated. Also, considering there is no regex helper. In v9 JSON schema rules were introduced (some improvements are coming to v9.1.0 soon), which makes this kind of validation way easier. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a mocked 400 response with several Rules applied to the request body. I want to then catch which rules failed in my Status & Body in order to return the correct error messages. Is there a way to call regex test or match in the Status & Body using helpers or handlebars?
If I have a couple rules like these:
Body, id, !, regex, ^.{7,10}$
Body, name, !, regex, ^.{1,50}$
I want to do something like this in the 'Status & Body' but make use of regex:
Beta Was this translation helpful? Give feedback.
All reactions