Route Parameters
You can define route parameters in the URL pattern and use them in the response via {{ }} syntax:
await mockClient.GET('https://jsonplaceholder.typicode.com/users/:id', {
body: {
id: '{{ id:number }}',
name: 'User {{ id }}',
}
});
The request:
GET https://jsonplaceholder.typicode.com/users/1
will be mocked with the response:
{
id: 1,
name: 'User 1',
}