File tree Expand file tree Collapse file tree 2 files changed +38
-1
lines changed
Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ module.exports = function (source, options) {
2828 headers : source . allHeaders
2929 }
3030
31+ if ( options . insecureSkipVerify ) {
32+ reqOpts . rejectUnauthorized = false
33+ }
34+
3135 code . push ( 'const http = require("%s");' , source . uriObj . protocol . replace ( ':' , '' ) )
3236
3337 code . blank ( )
Original file line number Diff line number Diff line change 11'use strict'
22
3- module . exports = function ( snippet , fixtures ) { }
3+ module . exports = function ( HTTPSnippet , fixtures ) {
4+ it ( 'should support the insecureSkipVerify option' , function ( ) {
5+ const result = new HTTPSnippet ( fixtures . requests . https ) . convert ( 'node' , 'native' , {
6+ insecureSkipVerify : true
7+ } )
8+
9+ result . should . be . a . String ( )
10+ result . should . eql ( `const http = require("https");
11+
12+ const options = {
13+ "method": "GET",
14+ "hostname": "mockbin.com",
15+ "port": null,
16+ "path": "/har",
17+ "headers": {},
18+ "rejectUnauthorized": false
19+ };
20+
21+ const req = http.request(options, function (res) {
22+ const chunks = [];
23+
24+ res.on("data", function (chunk) {
25+ chunks.push(chunk);
26+ });
27+
28+ res.on("end", function () {
29+ const body = Buffer.concat(chunks);
30+ console.log(body.toString());
31+ });
32+ });
33+
34+ req.end();` )
35+ } )
36+ }
You can’t perform that action at this time.
0 commit comments