diff --git a/codegens/curl/lib/index.js b/codegens/curl/lib/index.js index e8ef3d293..3bb80fb34 100644 --- a/codegens/curl/lib/index.js +++ b/codegens/curl/lib/index.js @@ -36,7 +36,7 @@ self = module.exports = { snippet += ` ${form('-m', format)} ${timeout}`; } if ((url.match(/[{[}\]]/g) || []).length > 0) { - snippet += ' -g'; + snippet += ` ${form('-g', format)}`; } if (multiLine) { indent = options.indentType === 'Tab' ? '\t' : ' '; diff --git a/codegens/curl/lib/util.js b/codegens/curl/lib/util.js index a53e498a3..2b9e93d97 100644 --- a/codegens/curl/lib/util.js +++ b/codegens/curl/lib/util.js @@ -57,6 +57,8 @@ var self = module.exports = { return '--data'; case '-F': return '--form'; + case '-g': + return '--globoff'; default: return ''; } diff --git a/codegens/curl/test/unit/convert.test.js b/codegens/curl/test/unit/convert.test.js index fae04d18e..32235b1e0 100644 --- a/codegens/curl/test/unit/convert.test.js +++ b/codegens/curl/test/unit/convert.test.js @@ -265,7 +265,7 @@ describe('curl convert function', function () { ']world', 'world}' ].forEach(function (value) { - request = new sdk.Request({ + const request = new sdk.Request({ 'method': 'GET', 'url': { 'raw': `http://example.com?hello=${value}`, @@ -288,6 +288,12 @@ describe('curl convert function', function () { } expect(snippet).to.include('-g'); }); + convert(request, { longFormat: true }, function (error, snippet) { + if (error) { + expect.fail(null, null, error); + } + expect(snippet).to.include('--globoff'); + }); }); });