You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
I have next problem.
I have such body in request: "body": "ignore_ip=1&data%5Bcomments_allowed_for%5D=0" . And I need to use second value in it (data[comments_allowed_for]) , but it's possible to get only first value ignore_ip.
How can I get other values except first? By documentation I can see next https://github.com/jmartin82/mmock/blob/master/config/body-form.json.
So I try to do next:
"{{ request.body.data[comments_allowed_for] }}"
"{{ request.body.data }}"
"{{ request.body.data.comments_allowed_for }}"
e.t.
But even when I do request using regex , for ex {{request.body.(?P\w+)}} , I get only first parameter ignore_ip .
So please tell me please what I should do to resolve my problem
The text was updated successfully, but these errors were encountered:
Hi @maryigoshyna are you using jmartin82's mmock repo or my fork, as it is older than the original one. My fork does not support request.body.data, so your only option is to use regex.
@vtrifonov , I use your http-api-mock.
But as I wrote in previous message, I try to use regex, but I get only first parameter . And Cannot get data (array) . Is it possible ? Maybe you can show me some examples
Thats because you are matching only letters with (?P\w+), if you want to get the value of comments_allowed_for you should use something like {{request.body..*comments_allowed_for.*=(?P<value>\\d+)}}. You need to add the regex that matches the value that you want from the body after request.body. including a named group value which will be the result from the match.
Hello!
I have next problem.
I have such body in request: "body": "ignore_ip=1&data%5Bcomments_allowed_for%5D=0" . And I need to use second value in it (data[comments_allowed_for]) , but it's possible to get only first value ignore_ip.
How can I get other values except first? By documentation I can see next https://github.com/jmartin82/mmock/blob/master/config/body-form.json.
So I try to do next:
"{{ request.body.data[comments_allowed_for] }}"
"{{ request.body.data }}"
"{{ request.body.data.comments_allowed_for }}"
e.t.
But even when I do request using regex , for ex {{request.body.(?P\w+)}} , I get only first parameter ignore_ip .
So please tell me please what I should do to resolve my problem
The text was updated successfully, but these errors were encountered: