Skip to content

Commit f744394

Browse files
committed
Add support for insecureSkipVerify with curl
1 parent 7320d04 commit f744394

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/targets/shell/curl.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ module.exports = function (source, options) {
3636
}
3737
code.push(util.format('%s%s', opts.short ? '' : '--url ', formattedUrl))
3838

39+
if (opts.insecureSkipVerify) {
40+
code.push(opts.short ? '-k' : '--insecure')
41+
}
42+
3943
if (source.httpVersion === 'HTTP/1.0') {
4044
code.push(opts.short ? '-0' : '--http1.0')
4145
}

test/targets/shell/curl.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ module.exports = function (HTTPSnippet, fixtures) {
5555
result.should.eql("curl --request GET --url 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value'")
5656
})
5757

58+
it('should support insecureSkipVerify', function () {
59+
const result = new HTTPSnippet(fixtures.requests.https).convert('shell', 'curl', {
60+
indent: false,
61+
insecureSkipVerify: true
62+
})
63+
64+
result.should.be.a.String()
65+
result.should.eql('curl --request GET --url https://mockbin.com/har --insecure')
66+
})
67+
5868
it('should use --http1.0 for HTTP/1.0', function () {
5969
const result = new HTTPSnippet(fixtures.curl.http1).convert('shell', 'curl', {
6070
indent: false

0 commit comments

Comments
 (0)