diff options
| author | ruki <waruqi@gmail.com> | 2018-11-08 00:38:48 +0800 |
|---|---|---|
| committer | ruki <waruqi@gmail.com> | 2018-11-07 21:53:09 +0800 |
| commit | 26105034da4fcce7ac883c899d781f016559310d (patch) | |
| tree | c459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/https-browserify | |
| parent | 2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff) | |
| download | xmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip | |
switch to vuepress
Diffstat (limited to 'node_modules/https-browserify')
| -rw-r--r-- | node_modules/https-browserify/LICENSE | 20 | ||||
| -rw-r--r-- | node_modules/https-browserify/index.js | 31 | ||||
| -rw-r--r-- | node_modules/https-browserify/package.json | 28 | ||||
| -rw-r--r-- | node_modules/https-browserify/readme.markdown | 22 |
4 files changed, 101 insertions, 0 deletions
diff --git a/node_modules/https-browserify/LICENSE b/node_modules/https-browserify/LICENSE new file mode 100644 index 00000000..e45bc693 --- /dev/null +++ b/node_modules/https-browserify/LICENSE @@ -0,0 +1,20 @@ +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 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/https-browserify/index.js b/node_modules/https-browserify/index.js new file mode 100644 index 00000000..cd203027 --- /dev/null +++ b/node_modules/https-browserify/index.js @@ -0,0 +1,31 @@ +var http = require('http') +var url = require('url') + +var https = module.exports + +for (var key in http) { + if (http.hasOwnProperty(key)) https[key] = http[key] +} + +https.request = function (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 new file mode 100644 index 00000000..a3c050c1 --- /dev/null +++ b/node_modules/https-browserify/package.json @@ -0,0 +1,28 @@ +{ + "name": "https-browserify", + "description": "https module compatability for browserify", + "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": [ + "browser", + "browserify", + "https" + ], + "license": "MIT", + "main": "index.js", + "repository": { + "type": "git", + "url": "git://github.com/substack/https-browserify.git" + }, + "scripts": { + "test": "standard" + } +} diff --git a/node_modules/https-browserify/readme.markdown b/node_modules/https-browserify/readme.markdown new file mode 100644 index 00000000..df04052a --- /dev/null +++ b/node_modules/https-browserify/readme.markdown @@ -0,0 +1,22 @@ +# https-browserify + +https module compatability for browserify + +# example + +``` js +var https = require('https-browserify') +var r = https.request('https://github.com') +r.on('request', function (res) { + console.log(res) +}) +``` + +# methods + +The API is the same as the client portion of the +[node core https module](http://nodejs.org/docs/latest/api/https.html). + +# license + +MIT |
