Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions core/examples/request-template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Request Templates
This is an example of a request template. This request template allows Hoverfly to serve a response to a partially matched request.

In this example, two templates are used for matching. The first will match a GET request to specto.io/virtualized. The second will match any request that includes the header "Match: true".

To import these templates into Hoverfly, you can run the following command:
```
hoverctl templates <path to file>
```
To see all request templates configured in Hoverfly, use the following command:
```
hoverctl templates
```
To find out more, please check the documentation regarding [partial matching](https://spectolabs.gitbooks.io/hoverfly/content/usage/matching_requests.html)
24 changes: 24 additions & 0 deletions core/examples/request-template/request-template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"data": [{
"requestTemplate": {
"path": "/virtualized",
"method": "GET",
"destination": "specto.io"
},
"response": {
"status": 201,
"encodedBody": false,
"body": "<h1>This page is virtualized</h1>"
}
}, {
"requestTemplate": {
"headers": {
"Match": ["true"]
}
},
"response": {
"status": 200,
"body": "<h1>Your request has been matched</h1>"
}
}]
}