function $de5802edb06247ca$var$wrap(protocols) {
    // Default settings
    var exports = {
        maxRedirects: 21,
        maxBodyLength: 10485760
    };
    // Wrap each protocol
    var nativeProtocols = {
    };
    Object.keys(protocols).forEach(function(scheme) {
        var protocol = scheme + ":";
        var nativeProtocol = nativeProtocols[protocol] = protocols[scheme];
        var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol);
        // Executes a request, following redirects
        function request(input, options, callback) {
            // Parse parameters
            if (typeof input === "string") {
                var urlStr = input;
                try {
                    input = $de5802edb06247ca$var$urlToOptions(new $de5802edb06247ca$var$URL(urlStr));
                } catch (err) {
                    /* istanbul ignore next */ input = $68DQ8$url.parse(urlStr);
                }
            } else if ($de5802edb06247ca$var$URL && input instanceof $de5802edb06247ca$var$URL) input = $de5802edb06247ca$var$urlToOptions(input);
            else {
                callback = options;
                options = input;
                input = {
                    protocol: protocol
                };
            }
            if (typeof options === "function") {
                callback = options;
                options = null;
            }
            // Set defaults
            options = Object.assign({
                maxRedirects: exports.maxRedirects,
                maxBodyLength: exports.maxBodyLength
            }, input, options);
            options.nativeProtocols = nativeProtocols;
            $68DQ8$assert.equal(options.protocol, protocol, "protocol mismatch");
            $i7w8w("options", options);
            return new $de5802edb06247ca$var$RedirectableRequest(options, callback);
        }
        // Executes a GET request, following redirects
        function get(input, options, callback) {
            var wrappedRequest = wrappedProtocol.request(input, options, callback);
            wrappedRequest.end();
            return wrappedRequest;
        }
        // Expose the properties on the wrapped protocol
        Object.defineProperties(wrappedProtocol, {
            request: {
                value: request,
                configurable: true,
                enumerable: true,
                writable: true
            },
            get: {
                value: get,
                configurable: true,
                enumerable: true,
                writable: true
            }
        });
    });
    return exports;
}
// Wraps the key/value object of protocols with redirect functionality
Wraps the key/value object of protocols with redirect functionality
Wraps the key / value object of protocols with redirect functionality
function $de5802edb06247ca$var$wrap(protocols) {
    var exports = {
        maxRedirects: 21,
        maxBodyLength: 10485760
    };
    var nativeProtocols = {
    };
    Object.keys(protocols).forEach(function(scheme) {
        var protocol = scheme + ":";
        var nativeProtocol = nativeProtocols[protocol] = protocols[scheme];
        var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol);
        function request(input, options, callback) {
            if (typeof input === "string") {
                var urlStr = input;
                try {
                    input = $de5802edb06247ca$var$urlToOptions(new $de5802edb06247ca$var$URL(urlStr));
                } catch (err) {
                     input = $68DQ8$url.parse(urlStr);
                }
            } else if ($de5802edb06247ca$var$URL && input instanceof $de5802edb06247ca$var$URL) input = $de5802edb06247ca$var$urlToOptions(input);
            else {
                callback = options;
                options = input;
                input = {
                    protocol: protocol
                };
            }
            if (typeof options === "function") {
                callback = options;
                options = null;
            }
            options = Object.assign({
                maxRedirects: exports.maxRedirects,
                maxBodyLength: exports.maxBodyLength
            }, input, options);
            options.nativeProtocols = nativeProtocols;
            $68DQ8$assert.equal(options.protocol, protocol, "protocol mismatch");
            $i7w8w("options", options);
            return new $de5802edb06247ca$var$RedirectableRequest(options, callback);
        }
        function get(input, options, callback) {
            var wrappedRequest = wrappedProtocol.request(input, options, callback);
            wrappedRequest.end();
            return wrappedRequest;
        }
        Object.defineProperties(wrappedProtocol, {
            request: {
                value: request,
                configurable: true,
                enumerable: true,
                writable: true
            },
            get: {
                value: get,
                configurable: true,
                enumerable: true,
                writable: true
            }
        });
    });
    return exports;
}
function $de5802edb06247ca$var$wrap ( protocols ) { var exports = { maxRedirects : 21 , maxBodyLength : 10485760 } ; var nativeProtocols = { } ; Object . keys ( protocols ) . forEach ( function ( scheme ) { var protocol = scheme + ":" ; var nativeProtocol = nativeProtocols [ protocol ] = protocols [ scheme ] ; var wrappedProtocol = exports [ scheme ] = Object . create ( nativeProtocol ) ; function request ( input , options , callback ) { if ( typeof input === "string" ) { var urlStr = input ; try { input = $de5802edb06247ca$var$urlToOptions ( new $de5802edb06247ca$var$URL ( urlStr ) ) ; } catch ( err ) { input = $68DQ8$url . parse ( urlStr ) ; } } else if ( $de5802edb06247ca$var$URL && input instanceof $de5802edb06247ca$var$URL ) input = $de5802edb06247ca$var$urlToOptions ( input ) ; else { callback = options ; options = input ; input = { protocol : protocol } ; } if ( typeof options === "function" ) { callback = options ; options = null ; } options = Object . assign ( { maxRedirects : exports . maxRedirects , maxBodyLength : exports . maxBodyLength } , input , options ) ; options . nativeProtocols = nativeProtocols ; $68DQ8$assert . equal ( options . protocol , protocol , "protocol mismatch" ) ; $i7w8w ( "options" , options ) ; return new $de5802edb06247ca$var$RedirectableRequest ( options , callback ) ; } function get ( input , options , callback ) { var wrappedRequest = wrappedProtocol . request ( input , options , callback ) ; wrappedRequest . end ( ) ; return wrappedRequest ; } Object . defineProperties ( wrappedProtocol , { request : { value : request , configurable : true , enumerable : true , writable : true } , get : { value : get , configurable : true , enumerable : true , writable : true } } ) ; } ) ; return exports ; }
Wraps the key/value object of protocols with redirect functionality
Wraps the key / value object of protocols with redirect functionality
// Default settings // Wrap each protocol // Executes a request, following redirects // Parse parameters /* istanbul ignore next */ // Set defaults // Executes a GET request, following redirects // Expose the properties on the wrapped protocol