🖥️ Try it yourself
$ spoof scaffold -o example-route-matching
Mock API URLs can be fixed, like this:
"request": {
"path": "/api/hello"
}(other parts of the JSON body have been hidden for clarity. See the scaffolded example for a complete file)
You can also include parameters in routes, like this:
"request": {
"path": "/api/{category:int}/products/{productName}"
}The parts of the route surrounded by { } will match any value, as long as the type is correct.
You can expicitly match int or uuid. If you do not specify a type, any value will be matched.
Here are some examples:
| Route | Will match | Will not match |
|---|---|---|
| /api/{ |
/api/ /api/ |
|
| /api/{ |
/api/ |
/api/ |
| /api/{ |
/api/ |
/api/ /api/ |
➡️ Next: Request Header Matching