Skip to content

Commit 6f603bf

Browse files
committed
1 parent 12ec38c commit 6f603bf

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/help.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,4 +428,35 @@ describe('help options', function () {
428428
}
429429
});
430430
});
431+
432+
it('has brackets in variables', function (done) {
433+
var spec = {
434+
paths: {
435+
'/foo': {
436+
post: {
437+
tags: [ 'test' ],
438+
operationId: 'sample',
439+
parameters: [
440+
{
441+
in: 'query',
442+
name: 'fields',
443+
type: 'string'
444+
}
445+
]
446+
}
447+
}
448+
}
449+
};
450+
451+
var client = new SwaggerClient({
452+
url: 'http://localhost:8080/petstore.yaml',
453+
spec: spec,
454+
success: function () {
455+
var msg = client.test.sample.asCurl({fields: '[articles]=title'});
456+
expect(msg).toBe("curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' 'http://localhost:8080/foo?fields=%5Barticles%5D%3Dtitle'");
457+
458+
done();
459+
}
460+
});
461+
});
431462
});

0 commit comments

Comments
 (0)