iridakos / duckrails

Development tool to mock API endpoints quickly and easily (docker image available)
https://github.com/iridakos/duckrails/wiki
MIT License
1.72k stars 108 forks source link

How to use query parameters? #56

Closed Banjerr closed 4 years ago

Banjerr commented 4 years ago

Is there currently a way to use optional query parameters for an endpoint?

For example, I would like to be able to use

localhost/v1/route?optional=1&dynamic=1

and still be able to hit localhost/v1/route without the query parameters...

When I attempt to add a query parameter to a mock endpoint then it is automatically "required", or else the endpoint is no longer found when trying to hit it.

iridakos commented 4 years ago

Hi @Banjerr,

You don't have to specify any parameters in the URL.

For your case I configured the following mock: image

with response body resolved to the parameters: image

and I can hit /v1/route with parameters:

image

or without parameters: image

Feel free to re-open this issue in case I didn't answer to your question.

Bye