Reputation: 6367
I am new to Mockoon. I am creating a POC for using Mockoon as a replacement for some of our mocks in our test suite. Everything works well for both POST and GET requests. However, one issue I'm having: there is one endpoint that uses a parameterized path, something like this:
/access/<parameter>/endpointName
I need to set up Mockoon to be able to handle an endpoint that uses a parameter like this. Does anyone know how to do this, or, is it even possible? Thanks!!
Upvotes: 1
Views: 1633
Reputation: 2709
In my case I wanted id stored in getEnvVar. So in Data tab I used:
[
id={{getEnvVar 'MOCKOON_LASTID'}}
]
And /:id
in path
Upvotes: 1
Reputation: 6974
Mockoon uses Express.js behind the scene. So, all of its syntaxes are supported.
To add a parameter to your endpoint you need to use the colon symbol: /access/:param/endpointName
.
You will then be able to access the parameter inside the rules or in your body using templating helpers.
Upvotes: 1