File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -127,13 +127,30 @@ request you want matched via body comments:
127
127
"response": "response for two@example.com"
128
128
}
129
129
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
+
130
146
To use in conjunction with response headers, list the response header first.
131
147
132
148
//! statusCode: 201
133
149
//! header: {"authorization": "abc"}
134
150
{
135
151
"response": "response for abc"
136
152
}
153
+
137
154
//! header: {"authorization": "123"}
138
155
{
139
156
"response": "response for 123"
@@ -228,6 +245,11 @@ feel free to [bug me on twitter](https://twitter.com/ischi)
228
245
229
246
Release History
230
247
---------------
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
+
231
253
### 0.2.3
232
254
* added support for empty response with 204 for no content (@jkjustjoshing )
233
255
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " canned" ,
3
- "version" : " 0.2. 3" ,
3
+ "version" : " 0.3" ,
4
4
"description" : " serve canned responses to mock an api, based on files in a folder" ,
5
5
"main" : " canned.js" ,
6
6
"scripts" : {
You can’t perform that action at this time.
0 commit comments