Skip to content

Commit dbf09d2

Browse files
committed
1 parent c259597 commit dbf09d2

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

test/help.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff 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
});

0 commit comments

Comments
 (0)