Skip to content

Route paths with variables

Lazarus Lazaridis edited this page Nov 17, 2017 · 1 revision

When creating a mock, you can specify a template path including variables.

For example, if you set your path to:

/people/:person_id/books/:book_title

then requests like

/people/1/books/sapiens

will be being served by this mock.

Especially if you are defining a dynamic mock, the path variables person_id and book_title will be available to you in the script as parameters (see creating a dynamic mock with Embedded Ruby or creating a dynamic mock with Javascript).