diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-12-10 21:51:33 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-12-10 21:51:33 +0100 |
commit | 0469abd4a9c9270a1fdc962969e36e63699af8b4 (patch) | |
tree | f9864d4a4148621378958794cbbfdc2393733283 /node_modules/https-browserify | |
parent | 6947e79bbc258f7bc96af424ddb71a511f0c15a3 (diff) | |
download | wallet-core-0469abd4a9c9270a1fdc962969e36e63699af8b4.tar.xz |
upgrade dependencies
Diffstat (limited to 'node_modules/https-browserify')
-rw-r--r-- | node_modules/https-browserify/LICENSE | 2 | ||||
-rw-r--r-- | node_modules/https-browserify/index.js | 33 | ||||
-rw-r--r-- | node_modules/https-browserify/package.json | 30 | ||||
-rw-r--r-- | node_modules/https-browserify/readme.markdown | 8 |
4 files changed, 49 insertions, 24 deletions
diff --git a/node_modules/https-browserify/LICENSE b/node_modules/https-browserify/LICENSE index ee27ba4b4..e45bc6932 100644 --- a/node_modules/https-browserify/LICENSE +++ b/node_modules/https-browserify/LICENSE @@ -1,5 +1,7 @@ This software is released under the MIT license: +Copyright (c) James Halliday + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to diff --git a/node_modules/https-browserify/index.js b/node_modules/https-browserify/index.js index 853553252..cd203027b 100644 --- a/node_modules/https-browserify/index.js +++ b/node_modules/https-browserify/index.js @@ -1,14 +1,31 @@ -var http = require('http'); +var http = require('http') +var url = require('url') -var https = module.exports; +var https = module.exports for (var key in http) { - if (http.hasOwnProperty(key)) https[key] = http[key]; -}; + if (http.hasOwnProperty(key)) https[key] = http[key] +} https.request = function (params, cb) { - if (!params) params = {}; - params.scheme = 'https'; - params.protocol = 'https:'; - return http.request.call(this, params, cb); + params = validateParams(params) + return http.request.call(this, params, cb) +} + +https.get = function (params, cb) { + params = validateParams(params) + return http.get.call(this, params, cb) +} + +function validateParams (params) { + if (typeof params === 'string') { + params = url.parse(params) + } + if (!params.protocol) { + params.protocol = 'https:' + } + if (params.protocol !== 'https:') { + throw new Error('Protocol "' + params.protocol + '" not supported. Expected "https:"') + } + return params } diff --git a/node_modules/https-browserify/package.json b/node_modules/https-browserify/package.json index b49b625d5..a3c050c1c 100644 --- a/node_modules/https-browserify/package.json +++ b/node_modules/https-browserify/package.json @@ -1,22 +1,28 @@ { "name": "https-browserify", - "version": "0.0.1", "description": "https module compatability for browserify", - "main": "index.js", - "repository": { - "type": "git", - "url": "git://github.com/substack/https-browserify.git" + "version": "1.0.0", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "devDependencies": { + "standard": "^9.0.2" }, "homepage": "https://github.com/substack/https-browserify", "keywords": [ - "https", "browser", - "browserify" + "browserify", + "https" ], - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" + "license": "MIT", + "main": "index.js", + "repository": { + "type": "git", + "url": "git://github.com/substack/https-browserify.git" }, - "license": "MIT" + "scripts": { + "test": "standard" + } } diff --git a/node_modules/https-browserify/readme.markdown b/node_modules/https-browserify/readme.markdown index 8638614fa..df04052a8 100644 --- a/node_modules/https-browserify/readme.markdown +++ b/node_modules/https-browserify/readme.markdown @@ -5,11 +5,11 @@ https module compatability for browserify # example ``` js -var https = require('https-browserify'); -var r = https.request('https://github.com'); +var https = require('https-browserify') +var r = https.request('https://github.com') r.on('request', function (res) { - console.log(res); -}); + console.log(res) +}) ``` # methods |