File tree Expand file tree Collapse file tree 3 files changed +48
-9
lines changed
Expand file tree Collapse file tree 3 files changed +48
-9
lines changed Original file line number Diff line number Diff line change @@ -161,11 +161,11 @@ A demonstration using regular expressions:
161161 method: [GET, HEAD]
162162
163163- request:
164- url: ^/yonder
165- method:
166- - GET
167- - HEAD
168- - POST
164+ url: ^/yonder
165+ method:
166+ - GET
167+ - HEAD
168+ - POST
169169` ` `
170170
171171# ### query
@@ -181,10 +181,26 @@ A demonstration using regular expressions:
181181
182182` ` ` yaml
183183- request:
184- url: ^/with/parameters$
185- query:
186- search: search terms
187- filter: month
184+ url: ^/with/parameters$
185+ query:
186+ search: search terms
187+ filter: month
188+ ` ` `
189+
190+ __NOTE__ : repeated querystring keys (often array representations) will have
191+ their values converted to a comma-separated list.
192+
193+ ```
194+ /url?array=one&array=two
195+ ```
196+
197+ will be matched by:
198+
199+ ```yaml
200+ - request:
201+ url: ^/url$
202+ query:
203+ array: one,two
188204```
189205
190206#### post
Original file line number Diff line number Diff line change 127127 headers :
128128 Content-Type : ' application/json'
129129 Set-Cookie : ['type=ninja', 'language=coffeescript']
130+
131+ - request :
132+ url : /query/array
133+ query :
134+ array : one,two
135+ response :
136+ body : query as array works!
Original file line number Diff line number Diff line change @@ -296,6 +296,22 @@ describe('End 2 End Stubs Test Suite', function () {
296296 done ( ) ;
297297 } ) ;
298298 } ) ;
299+
300+ it ( 'should comma-separate repeated query params' , function ( done ) {
301+ var self = this ;
302+ this . context . url = '/query/array?array=one&array=two' ;
303+ this . context . method = 'get' ;
304+
305+ createRequest ( this . context ) ;
306+
307+ waitsFor ( function ( ) {
308+ return self . context . done ;
309+ } , 'request to finish' , 1000 , function ( ) {
310+ assert ( self . context . response . statusCode === 200 ) ;
311+ assert ( self . context . response . data === 'query as array works!' ) ;
312+ done ( ) ;
313+ } ) ;
314+ } ) ;
299315 } ) ;
300316
301317 describe ( 'post' , function ( ) {
You can’t perform that action at this time.
0 commit comments