Skip to content

Add support for custom query parameters#6

Open
apellizzn wants to merge 2 commits into
paramadeep:masterfrom
apellizzn:master
Open

Add support for custom query parameters#6
apellizzn wants to merge 2 commits into
paramadeep:masterfrom
apellizzn:master

Conversation

@apellizzn
Copy link
Copy Markdown

Given the following yml stub

request:
  url: book
  method: get
  query:
    author: "asd"
    name: "don"
response:
  body:  '{
    "title": "independance",
    "category": {
      "age_group": "10",
      "genre": "action",
      "publisher": {
        "name": "summa",
        "place":"erode"
      }
    }
  }'

Support for custom query parameters

Book.new.for_custom({color: 'red'}).build

Will stub http://localhost:3030/book?author=asd&name=don&color=red

Support removing default query paramters

Book.new.without(:author).build

Will remove the default author query parameter and stub http://localhost:3030/book?name=don

@paramadeep
Copy link
Copy Markdown
Owner

Hi Alberto,
Thanks for the commits.
for_custom might create a conflict if we have parameter named custom. If you could come up with a more amicable way would be good. Did you considered using "query_explicit: true"

@apellizzn
Copy link
Copy Markdown
Author

Hi,
Thank for your response, you are absolutely right about that, would you prefer something like "add_custom" ?
Regarding "query_explicit: true" i have been using it but in some cases i would prefer a "without" method to handle the query stub in a more dynamic way, if you do not agree with that i can take it off

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants