File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -359,4 +359,39 @@ describe('help options', function () {
359359 }
360360 } ) ;
361361 } ) ;
362+
363+ it ( 'handles formData with brackets' , function ( done ) {
364+ var spec = {
365+ paths : {
366+ '/foo' : {
367+ post : {
368+ tags : [ 'test' ] ,
369+ operationId : 'sample' ,
370+ consumes : [ 'application/x-www-form-urlencoded' ] ,
371+ parameters : [
372+ {
373+ in : 'formData' ,
374+ name : 'names' ,
375+ type : 'array' ,
376+ items : {
377+ type : 'string'
378+ } ,
379+ collectionFormat : 'brackets'
380+ }
381+ ]
382+ }
383+ }
384+ }
385+ } ;
386+
387+ var client = new SwaggerClient ( {
388+ url : 'http://localhost:8080/petstore.yaml' ,
389+ spec : spec ,
390+ success : function ( ) {
391+ var msg = client . test . sample . asCurl ( { names : [ 'tony' , 'tam' ] } ) ;
392+ expect ( msg ) . toBe ( "curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d 'names[]=tony%26names[]=tam' 'http://localhost:8080/foo'" ) ;
393+ done ( ) ;
394+ }
395+ } ) ;
396+ } ) ;
362397} ) ;
You can’t perform that action at this time.
0 commit comments