Skip to content

Commit 30f454f

Browse files
committed
update README
1 parent a640546 commit 30f454f

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,30 @@ request you want matched via body comments:
127127
"response": "response for two@example.com"
128128
}
129129

130+
If you need different responses based on request parameters then you can specify
131+
them via parameters comments:
132+
133+
//! params: {"foo": "bar"}
134+
{
135+
"response": "response for bar"
136+
}
137+
138+
//! params: {"foo": "baz"}
139+
{
140+
"response": "response for baz"
141+
}
142+
143+
this would match `http://my.local.server/my_get_request_path?foo=bar` or
144+
`http://my.local.server/my_get_request_path?foo=baz` respectively.
145+
130146
To use in conjunction with response headers, list the response header first.
131147

132148
//! statusCode: 201
133149
//! header: {"authorization": "abc"}
134150
{
135151
"response": "response for abc"
136152
}
153+
137154
//! header: {"authorization": "123"}
138155
{
139156
"response": "response for 123"
@@ -228,6 +245,11 @@ feel free to [bug me on twitter](https://twitter.com/ischi)
228245

229246
Release History
230247
---------------
248+
### 0.3
249+
* support for multiple responses per file (@hungrydavid)
250+
* support for GET responses without the need for special characters in the
251+
filename (@sideshowcoder based on the work by @hungrydavid)
252+
231253
### 0.2.3
232254
* added support for empty response with 204 for no content (@jkjustjoshing)
233255

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "canned",
3-
"version": "0.2.3",
3+
"version": "0.3",
44
"description": "serve canned responses to mock an api, based on files in a folder",
55
"main": "canned.js",
66
"scripts": {

0 commit comments

Comments
 (0)