coduo / TuTu

Flexible HTTP server mocking tool in PHP. TuTu can work with built-in php server so everything that you need to use is php.
MIT License
58 stars 10 forks source link

Passing variables from url placeholders into response content template #17

Closed norberttech closed 10 years ago

norberttech commented 10 years ago

From now values under placeholders in url are going to be available in twig template under path variable. If there are no placehodlers path variable will be an empty array.

Simple example:

# responses.yml
request_with_variables_in_request_path:
  request:
    path: "/users/{email}/tasks/{taskId}"
  response:
    content: "Get task with ID {{path.taskId}} from user with email {{path.email}}"

So now after http request on "/users/norbert@coduo.pl/tasks/1" TuTu will return following response:

Get task with ID 1 from user with email norbert@coduo.pl