diff options
| author | 8cy <[email protected]> | 2020-04-03 02:48:28 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-04-03 02:48:28 -0700 |
| commit | f9159ea2d994e14180fb02ab562f0119513e67cf (patch) | |
| tree | 09d14cdf05456567156738b681379d4bccd64e5c /node_modules/http-response-object | |
| parent | 2020/04/03, 02:42, V1.2.1 (diff) | |
| download | s5nical-f9159ea2d994e14180fb02ab562f0119513e67cf.tar.xz s5nical-f9159ea2d994e14180fb02ab562f0119513e67cf.zip | |
2020/04/03, 02:47, V1.2.2
Diffstat (limited to 'node_modules/http-response-object')
| -rw-r--r-- | node_modules/http-response-object/.npmignore | 13 | ||||
| -rw-r--r-- | node_modules/http-response-object/.travis.yml | 3 | ||||
| -rw-r--r-- | node_modules/http-response-object/LICENSE | 19 | ||||
| -rw-r--r-- | node_modules/http-response-object/README.md | 44 | ||||
| -rw-r--r-- | node_modules/http-response-object/index.js | 43 | ||||
| -rw-r--r-- | node_modules/http-response-object/package.json | 53 | ||||
| -rw-r--r-- | node_modules/http-response-object/test/index.js | 37 |
7 files changed, 0 insertions, 212 deletions
diff --git a/node_modules/http-response-object/.npmignore b/node_modules/http-response-object/.npmignore deleted file mode 100644 index b83202d..0000000 --- a/node_modules/http-response-object/.npmignore +++ /dev/null @@ -1,13 +0,0 @@ -lib-cov -*.seed -*.log -*.csv -*.dat -*.out -*.pid -*.gz -pids -logs -results -npm-debug.log -node_modules diff --git a/node_modules/http-response-object/.travis.yml b/node_modules/http-response-object/.travis.yml deleted file mode 100644 index 6e5919d..0000000 --- a/node_modules/http-response-object/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: node_js -node_js: - - "0.10" diff --git a/node_modules/http-response-object/LICENSE b/node_modules/http-response-object/LICENSE deleted file mode 100644 index 27cc9f3..0000000 --- a/node_modules/http-response-object/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2014 Forbes Lindesay - -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.
\ No newline at end of file diff --git a/node_modules/http-response-object/README.md b/node_modules/http-response-object/README.md deleted file mode 100644 index 7b1ad2a..0000000 --- a/node_modules/http-response-object/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# http-response-object - -A simple object to represent an http response - -[](https://travis-ci.org/ForbesLindesay/http-response-object) -[](https://gemnasium.com/ForbesLindesay/http-response-object) -[](https://www.npmjs.org/package/http-response-object) - - -## Installation - - npm install http-response-object - -## Usage - -```js -var Response = require('http-response-object'); -var res = new Response(200, {}, new Buffer('A ok'), 'http://example.com'); -//res.statusCode === 200 -//res.headers === {} -//res.body === new Buffer('A ok') -//res.url === 'http://example.com' -res.getBody(); -// => new Buffer('A ok') - -var res = new Response(404, {'Header': 'value'}, new Buffer('Wheres this page'), 'http://example.com'); -//res.statusCode === 404 -//res.headers === {header: 'value'} -//res.body === new Buffer('Wheres this page') -//res.url === 'http://example.com' -res.getBody(); -// => throws error with `statusCode`, `headers`, `body` and `url` properties copied from the response -``` - -## Properties - - - `statusCode`: Number - the status code of the response - - `headers`: Object - the headers of the response. The keys are automatically made lower case. - - `body`: Buffer | String - the body of the response. Should be a buffer on the server side, but may be a simple string for lighter weight clients. - - `url`: String - the url that was requested. If there were redirects, this should be the last url to get requested. - -## License - - MIT diff --git a/node_modules/http-response-object/index.js b/node_modules/http-response-object/index.js deleted file mode 100644 index 70542d4..0000000 --- a/node_modules/http-response-object/index.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict'; - -module.exports = Response; - -/** - * A response from a web request - * - * @param {Number} statusCode - * @param {Object} headers - * @param {Buffer} body - * @param {String} url - */ -function Response(statusCode, headers, body, url) { - if (typeof statusCode !== 'number') { - throw new TypeError('statusCode must be a number but was ' + (typeof statusCode)); - } - if (headers === null) { - throw new TypeError('headers cannot be null'); - } - if (typeof headers !== 'object') { - throw new TypeError('headers must be an object but was ' + (typeof headers)); - } - this.statusCode = statusCode; - this.headers = {}; - for (var key in headers) { - this.headers[key.toLowerCase()] = headers[key]; - } - this.body = body; - this.url = url; -} - -Response.prototype.getBody = function (encoding) { - if (this.statusCode >= 300) { - var err = new Error('Server responded with status code ' - + this.statusCode + ':\n' + this.body.toString()); - err.statusCode = this.statusCode; - err.headers = this.headers; - err.body = this.body; - err.url = this.url; - throw err; - } - return encoding ? this.body.toString(encoding) : this.body; -}; diff --git a/node_modules/http-response-object/package.json b/node_modules/http-response-object/package.json deleted file mode 100644 index d3e2c6e..0000000 --- a/node_modules/http-response-object/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "_from": "http-response-object@^1.0.1", - "_id": "[email protected]", - "_inBundle": false, - "_integrity": "sha1-p8TnWq6C87tJBOT0P2FWc7TVGMM=", - "_location": "/http-response-object", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "http-response-object@^1.0.1", - "name": "http-response-object", - "escapedName": "http-response-object", - "rawSpec": "^1.0.1", - "saveSpec": null, - "fetchSpec": "^1.0.1" - }, - "_requiredBy": [ - "/http-basic", - "/sync-request", - "/then-request" - ], - "_resolved": "https://registry.npmjs.org/http-response-object/-/http-response-object-1.1.0.tgz", - "_shasum": "a7c4e75aae82f3bb4904e4f43f615673b4d518c3", - "_spec": "http-response-object@^1.0.1", - "_where": "E:\\Documents\\GitHub\\s5nical\\node_modules\\sync-request", - "author": { - "name": "ForbesLindesay" - }, - "bugs": { - "url": "https://github.com/ForbesLindesay/http-response-object/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "A simple object to represent an http response", - "homepage": "https://github.com/ForbesLindesay/http-response-object#readme", - "keywords": [ - "http", - "https", - "response", - "request" - ], - "license": "MIT", - "name": "http-response-object", - "repository": { - "type": "git", - "url": "git+https://github.com/ForbesLindesay/http-response-object.git" - }, - "scripts": { - "test": "node test" - }, - "version": "1.1.0" -} diff --git a/node_modules/http-response-object/test/index.js b/node_modules/http-response-object/test/index.js deleted file mode 100644 index 0ff4e16..0000000 --- a/node_modules/http-response-object/test/index.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; - -var assert = require('assert'); -var Response = require('../'); - -var res = new Response(200, { - 'Foo-Bar': 'baz-Bosh', - 'bar-foo': 'bish-Bosh' -}, 'foo bar baz', 'http://example.com'); -assert(res.statusCode = 200); -assert(res.headers['foo-bar'] === 'baz-Bosh'); -assert(res.headers['bar-foo'] === 'bish-Bosh'); -assert(res.body === 'foo bar baz'); -assert(res.url === 'http://example.com'); -assert(res.getBody() === 'foo bar baz'); - -res = new Response(404, { - 'Foo-Bar': 'baz-Bosh' -}, 'Could not find page', 'http://example.com'); -assert(res.statusCode = 404); -assert(res.headers['foo-bar'] === 'baz-Bosh'); -assert(res.body === 'Could not find page'); -assert(res.url === 'http://example.com'); -var errored = false; -try { - res.getBody(); -} catch (ex) { - assert(ex.statusCode === 404); - assert(ex.headers['foo-bar'] === 'baz-Bosh'); - assert(ex.body === 'Could not find page'); - assert(ex.url === 'http://example.com'); - errored = true; -} -if (!errored) { - throw new Error('res.getBody() should throw an error when the status code is 404'); -} -console.log('tests passed'); |