New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow composing multiple matches to one response #463
Comments
Thanks for the suggestion, but I'm struggling to imagine what that would
look like. Do you have an example imposter JSON in mind you can use to
explain the idea a bit more?
-Brandon
…On Mon, Oct 7, 2019 at 3:54 AM Daniel Demus ***@***.***> wrote:
Assume you have set up predicates that match one of a list of numbers (fx,
PINs). Assume the expected response contains a block of xml or json for
each matched result, but only for each matched value.
As I understand it, the first matching predicate wins, sot the only way I
see to do this is to create mocks with a predicates in the right order that
matches all the expected combinations or with javascript.
I suggest to add a factility that allows all predicates to be evaluated
and their respective outputs to be concatenated with a header and footer
block.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#463?email_source=notifications&email_token=AAARFP7GFZ4LQBJVS3JO7XDQNL2L5A5CNFSM4I6BSAL2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HP77WFA>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAARFP5WADTOSDPNA7ZXRJTQNL2L5ANCNFSM4I6BSALQ>
.
|
Let's say your request body is something like
I am not using json or xml to avoid being refered to the xpath and jsonpath predicates.
Let's say the return value is supposed to be xml:
Notice that the result element needs to be repeated for every match substituting part of the matched text.
The "from" could also just default to the text matched by a given predicate. You could also implement something like this for xpath or jsonpath predicates that match multiple nodes. |
I can send you the javascript implementation that produces the required result, if that would help. |
Sure!
…On Wed, Mar 18, 2020 at 3:35 AM Daniel Demus ***@***.***> wrote:
I can send you the javascript implementation that produces the required
result, if that would help.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#463 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAARFP5PD2SU6UGQTAN4ADDRICBWHANCNFSM4I6BSALQ>
.
|
Sorry, I was distracted. Anyway here is an example of what I ended up doing in cucumber/groovy to generate a chunk of json, that could be sent to mountebank, so it could have a chunk of javascript, that could generate a chunk of XML with the correct aggregate response, when the input was a set of search values that contained some matches and some non-matches:
I hope you read groovy. |
Hi, sorry, is it working? Or going to be merged someday? |
Assume you have set up predicates that each matches one of a list of numbers (fx, PINs). Assume the expected response contains a block of xml or json for each matched result, but only for the matched values.
As I understand it, the first matching predicate wins, so the only way I see to do this is to create mocks with a predicates in the right order that matches all the expected combinations or with javascript.
I suggest to add a factility that allows all predicates to be evaluated and their respective outputs to be concatenated with a header and footer block.
The text was updated successfully, but these errors were encountered: