smocker-dev/smocker

Mock with path param

aswzen opened this issue · 1 comments

How to create a mock with a path params

For example hello/world/{param}

- request: method: GET path: '/hello/world/{param}' response: status: 200

The the param sent to response
'Hello {param}"

Thanks
Git

Hi, you can use a string matcher to do that. https://smocker.dev/technical-documentation/mock-definition.html#string-matchers

- request:
    methode: GET
    path:
      matcher: ShouldMatch
      value: /hello/world/.*
  response:
    status: 200

And if you want to use it in the response you can use a dynamic response using lua or go templates https://smocker.dev/technical-documentation/mock-definition.html#format-of-dynamic-response-section