Express Server erstellt
This commit is contained in:
167
express-server/node_modules/finalhandler/HISTORY.md
generated
vendored
Normal file
167
express-server/node_modules/finalhandler/HISTORY.md
generated
vendored
Normal file
@ -0,0 +1,167 @@
|
||||
1.0.6 / 2017-09-22
|
||||
==================
|
||||
|
||||
* deps: debug@2.6.9
|
||||
|
||||
1.0.5 / 2017-09-15
|
||||
==================
|
||||
|
||||
* deps: parseurl@~1.3.2
|
||||
- perf: reduce overhead for full URLs
|
||||
- perf: unroll the "fast-path" `RegExp`
|
||||
|
||||
1.0.4 / 2017-08-03
|
||||
==================
|
||||
|
||||
* deps: debug@2.6.8
|
||||
|
||||
1.0.3 / 2017-05-16
|
||||
==================
|
||||
|
||||
* deps: debug@2.6.7
|
||||
- deps: ms@2.0.0
|
||||
|
||||
1.0.2 / 2017-04-22
|
||||
==================
|
||||
|
||||
* deps: debug@2.6.4
|
||||
- deps: ms@0.7.3
|
||||
|
||||
1.0.1 / 2017-03-21
|
||||
==================
|
||||
|
||||
* Fix missing `</html>` in HTML document
|
||||
* deps: debug@2.6.3
|
||||
- Fix: `DEBUG_MAX_ARRAY_LENGTH`
|
||||
|
||||
1.0.0 / 2017-02-15
|
||||
==================
|
||||
|
||||
* Fix exception when `err` cannot be converted to a string
|
||||
* Fully URL-encode the pathname in the 404 message
|
||||
* Only include the pathname in the 404 message
|
||||
* Send complete HTML document
|
||||
* Set `Content-Security-Policy: default-src 'self'` header
|
||||
* deps: debug@2.6.1
|
||||
- Allow colors in workers
|
||||
- Deprecated `DEBUG_FD` environment variable set to `3` or higher
|
||||
- Fix error when running under React Native
|
||||
- Use same color for same namespace
|
||||
- deps: ms@0.7.2
|
||||
|
||||
0.5.1 / 2016-11-12
|
||||
==================
|
||||
|
||||
* Fix exception when `err.headers` is not an object
|
||||
* deps: statuses@~1.3.1
|
||||
* perf: hoist regular expressions
|
||||
* perf: remove duplicate validation path
|
||||
|
||||
0.5.0 / 2016-06-15
|
||||
==================
|
||||
|
||||
* Change invalid or non-numeric status code to 500
|
||||
* Overwrite status message to match set status code
|
||||
* Prefer `err.statusCode` if `err.status` is invalid
|
||||
* Set response headers from `err.headers` object
|
||||
* Use `statuses` instead of `http` module for status messages
|
||||
- Includes all defined status messages
|
||||
|
||||
0.4.1 / 2015-12-02
|
||||
==================
|
||||
|
||||
* deps: escape-html@~1.0.3
|
||||
- perf: enable strict mode
|
||||
- perf: optimize string replacement
|
||||
- perf: use faster string coercion
|
||||
|
||||
0.4.0 / 2015-06-14
|
||||
==================
|
||||
|
||||
* Fix a false-positive when unpiping in Node.js 0.8
|
||||
* Support `statusCode` property on `Error` objects
|
||||
* Use `unpipe` module for unpiping requests
|
||||
* deps: escape-html@1.0.2
|
||||
* deps: on-finished@~2.3.0
|
||||
- Add defined behavior for HTTP `CONNECT` requests
|
||||
- Add defined behavior for HTTP `Upgrade` requests
|
||||
- deps: ee-first@1.1.1
|
||||
* perf: enable strict mode
|
||||
* perf: remove argument reassignment
|
||||
|
||||
0.3.6 / 2015-05-11
|
||||
==================
|
||||
|
||||
* deps: debug@~2.2.0
|
||||
- deps: ms@0.7.1
|
||||
|
||||
0.3.5 / 2015-04-22
|
||||
==================
|
||||
|
||||
* deps: on-finished@~2.2.1
|
||||
- Fix `isFinished(req)` when data buffered
|
||||
|
||||
0.3.4 / 2015-03-15
|
||||
==================
|
||||
|
||||
* deps: debug@~2.1.3
|
||||
- Fix high intensity foreground color for bold
|
||||
- deps: ms@0.7.0
|
||||
|
||||
0.3.3 / 2015-01-01
|
||||
==================
|
||||
|
||||
* deps: debug@~2.1.1
|
||||
* deps: on-finished@~2.2.0
|
||||
|
||||
0.3.2 / 2014-10-22
|
||||
==================
|
||||
|
||||
* deps: on-finished@~2.1.1
|
||||
- Fix handling of pipelined requests
|
||||
|
||||
0.3.1 / 2014-10-16
|
||||
==================
|
||||
|
||||
* deps: debug@~2.1.0
|
||||
- Implement `DEBUG_FD` env variable support
|
||||
|
||||
0.3.0 / 2014-09-17
|
||||
==================
|
||||
|
||||
* Terminate in progress response only on error
|
||||
* Use `on-finished` to determine request status
|
||||
|
||||
0.2.0 / 2014-09-03
|
||||
==================
|
||||
|
||||
* Set `X-Content-Type-Options: nosniff` header
|
||||
* deps: debug@~2.0.0
|
||||
|
||||
0.1.0 / 2014-07-16
|
||||
==================
|
||||
|
||||
* Respond after request fully read
|
||||
- prevents hung responses and socket hang ups
|
||||
* deps: debug@1.0.4
|
||||
|
||||
0.0.3 / 2014-07-11
|
||||
==================
|
||||
|
||||
* deps: debug@1.0.3
|
||||
- Add support for multiple wildcards in namespaces
|
||||
|
||||
0.0.2 / 2014-06-19
|
||||
==================
|
||||
|
||||
* Handle invalid status codes
|
||||
|
||||
0.0.1 / 2014-06-05
|
||||
==================
|
||||
|
||||
* deps: debug@1.0.2
|
||||
|
||||
0.0.0 / 2014-06-05
|
||||
==================
|
||||
|
||||
* Extracted from connect/express
|
22
express-server/node_modules/finalhandler/LICENSE
generated
vendored
Normal file
22
express-server/node_modules/finalhandler/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014-2017 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
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.
|
148
express-server/node_modules/finalhandler/README.md
generated
vendored
Normal file
148
express-server/node_modules/finalhandler/README.md
generated
vendored
Normal file
@ -0,0 +1,148 @@
|
||||
# finalhandler
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-image]][node-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Node.js function to invoke as the final step to respond to HTTP request.
|
||||
|
||||
## Installation
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```sh
|
||||
$ npm install finalhandler
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
<!-- eslint-disable no-unused-vars -->
|
||||
|
||||
```js
|
||||
var finalhandler = require('finalhandler')
|
||||
```
|
||||
|
||||
### finalhandler(req, res, [options])
|
||||
|
||||
Returns function to be invoked as the final step for the given `req` and `res`.
|
||||
This function is to be invoked as `fn(err)`. If `err` is falsy, the handler will
|
||||
write out a 404 response to the `res`. If it is truthy, an error response will
|
||||
be written out to the `res`.
|
||||
|
||||
When an error is written, the following information is added to the response:
|
||||
|
||||
* The `res.statusCode` is set from `err.status` (or `err.statusCode`). If
|
||||
this value is outside the 4xx or 5xx range, it will be set to 500.
|
||||
* The `res.statusMessage` is set according to the status code.
|
||||
* The body will be the HTML of the status code message if `env` is
|
||||
`'production'`, otherwise will be `err.stack`.
|
||||
* Any headers specified in an `err.headers` object.
|
||||
|
||||
The final handler will also unpipe anything from `req` when it is invoked.
|
||||
|
||||
#### options.env
|
||||
|
||||
By default, the environment is determined by `NODE_ENV` variable, but it can be
|
||||
overridden by this option.
|
||||
|
||||
#### options.onerror
|
||||
|
||||
Provide a function to be called with the `err` when it exists. Can be used for
|
||||
writing errors to a central location without excessive function generation. Called
|
||||
as `onerror(err, req, res)`.
|
||||
|
||||
## Examples
|
||||
|
||||
### always 404
|
||||
|
||||
```js
|
||||
var finalhandler = require('finalhandler')
|
||||
var http = require('http')
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
var done = finalhandler(req, res)
|
||||
done()
|
||||
})
|
||||
|
||||
server.listen(3000)
|
||||
```
|
||||
|
||||
### perform simple action
|
||||
|
||||
```js
|
||||
var finalhandler = require('finalhandler')
|
||||
var fs = require('fs')
|
||||
var http = require('http')
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
var done = finalhandler(req, res)
|
||||
|
||||
fs.readFile('index.html', function (err, buf) {
|
||||
if (err) return done(err)
|
||||
res.setHeader('Content-Type', 'text/html')
|
||||
res.end(buf)
|
||||
})
|
||||
})
|
||||
|
||||
server.listen(3000)
|
||||
```
|
||||
|
||||
### use with middleware-style functions
|
||||
|
||||
```js
|
||||
var finalhandler = require('finalhandler')
|
||||
var http = require('http')
|
||||
var serveStatic = require('serve-static')
|
||||
|
||||
var serve = serveStatic('public')
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
var done = finalhandler(req, res)
|
||||
serve(req, res, done)
|
||||
})
|
||||
|
||||
server.listen(3000)
|
||||
```
|
||||
|
||||
### keep log of all errors
|
||||
|
||||
```js
|
||||
var finalhandler = require('finalhandler')
|
||||
var fs = require('fs')
|
||||
var http = require('http')
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
var done = finalhandler(req, res, {onerror: logerror})
|
||||
|
||||
fs.readFile('index.html', function (err, buf) {
|
||||
if (err) return done(err)
|
||||
res.setHeader('Content-Type', 'text/html')
|
||||
res.end(buf)
|
||||
})
|
||||
})
|
||||
|
||||
server.listen(3000)
|
||||
|
||||
function logerror (err) {
|
||||
console.error(err.stack || err.toString())
|
||||
}
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/finalhandler.svg
|
||||
[npm-url]: https://npmjs.org/package/finalhandler
|
||||
[node-image]: https://img.shields.io/node/v/finalhandler.svg
|
||||
[node-url]: https://nodejs.org/en/download
|
||||
[travis-image]: https://img.shields.io/travis/pillarjs/finalhandler.svg
|
||||
[travis-url]: https://travis-ci.org/pillarjs/finalhandler
|
||||
[coveralls-image]: https://img.shields.io/coveralls/pillarjs/finalhandler.svg
|
||||
[coveralls-url]: https://coveralls.io/r/pillarjs/finalhandler?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/finalhandler.svg
|
||||
[downloads-url]: https://npmjs.org/package/finalhandler
|
300
express-server/node_modules/finalhandler/index.js
generated
vendored
Normal file
300
express-server/node_modules/finalhandler/index.js
generated
vendored
Normal file
@ -0,0 +1,300 @@
|
||||
/*!
|
||||
* finalhandler
|
||||
* Copyright(c) 2014-2017 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var debug = require('debug')('finalhandler')
|
||||
var encodeUrl = require('encodeurl')
|
||||
var escapeHtml = require('escape-html')
|
||||
var onFinished = require('on-finished')
|
||||
var parseUrl = require('parseurl')
|
||||
var statuses = require('statuses')
|
||||
var unpipe = require('unpipe')
|
||||
|
||||
/**
|
||||
* Module variables.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var DOUBLE_SPACE_REGEXP = /\x20{2}/g
|
||||
var NEWLINE_REGEXP = /\n/g
|
||||
|
||||
/* istanbul ignore next */
|
||||
var defer = typeof setImmediate === 'function'
|
||||
? setImmediate
|
||||
: function (fn) { process.nextTick(fn.bind.apply(fn, arguments)) }
|
||||
var isFinished = onFinished.isFinished
|
||||
|
||||
/**
|
||||
* Create a minimal HTML document.
|
||||
*
|
||||
* @param {string} message
|
||||
* @private
|
||||
*/
|
||||
|
||||
function createHtmlDocument (message) {
|
||||
var body = escapeHtml(message)
|
||||
.replace(NEWLINE_REGEXP, '<br>')
|
||||
.replace(DOUBLE_SPACE_REGEXP, ' ')
|
||||
|
||||
return '<!DOCTYPE html>\n' +
|
||||
'<html lang="en">\n' +
|
||||
'<head>\n' +
|
||||
'<meta charset="utf-8">\n' +
|
||||
'<title>Error</title>\n' +
|
||||
'</head>\n' +
|
||||
'<body>\n' +
|
||||
'<pre>' + body + '</pre>\n' +
|
||||
'</body>\n' +
|
||||
'</html>\n'
|
||||
}
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = finalhandler
|
||||
|
||||
/**
|
||||
* Create a function to handle the final response.
|
||||
*
|
||||
* @param {Request} req
|
||||
* @param {Response} res
|
||||
* @param {Object} [options]
|
||||
* @return {Function}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function finalhandler (req, res, options) {
|
||||
var opts = options || {}
|
||||
|
||||
// get environment
|
||||
var env = opts.env || process.env.NODE_ENV || 'development'
|
||||
|
||||
// get error callback
|
||||
var onerror = opts.onerror
|
||||
|
||||
return function (err) {
|
||||
var headers
|
||||
var msg
|
||||
var status
|
||||
|
||||
// ignore 404 on in-flight response
|
||||
if (!err && res._header) {
|
||||
debug('cannot 404 after headers sent')
|
||||
return
|
||||
}
|
||||
|
||||
// unhandled error
|
||||
if (err) {
|
||||
// respect status code from error
|
||||
status = getErrorStatusCode(err)
|
||||
|
||||
// respect headers from error
|
||||
if (status !== undefined) {
|
||||
headers = getErrorHeaders(err)
|
||||
}
|
||||
|
||||
// fallback to status code on response
|
||||
if (status === undefined) {
|
||||
status = getResponseStatusCode(res)
|
||||
}
|
||||
|
||||
// get error message
|
||||
msg = getErrorMessage(err, status, env)
|
||||
} else {
|
||||
// not found
|
||||
status = 404
|
||||
msg = 'Cannot ' + req.method + ' ' + encodeUrl(parseUrl.original(req).pathname)
|
||||
}
|
||||
|
||||
debug('default %s', status)
|
||||
|
||||
// schedule onerror callback
|
||||
if (err && onerror) {
|
||||
defer(onerror, err, req, res)
|
||||
}
|
||||
|
||||
// cannot actually respond
|
||||
if (res._header) {
|
||||
debug('cannot %d after headers sent', status)
|
||||
req.socket.destroy()
|
||||
return
|
||||
}
|
||||
|
||||
// send response
|
||||
send(req, res, status, headers, msg)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get headers from Error object.
|
||||
*
|
||||
* @param {Error} err
|
||||
* @return {object}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function getErrorHeaders (err) {
|
||||
if (!err.headers || typeof err.headers !== 'object') {
|
||||
return undefined
|
||||
}
|
||||
|
||||
var headers = Object.create(null)
|
||||
var keys = Object.keys(err.headers)
|
||||
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i]
|
||||
headers[key] = err.headers[key]
|
||||
}
|
||||
|
||||
return headers
|
||||
}
|
||||
|
||||
/**
|
||||
* Get message from Error object, fallback to status message.
|
||||
*
|
||||
* @param {Error} err
|
||||
* @param {number} status
|
||||
* @param {string} env
|
||||
* @return {string}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function getErrorMessage (err, status, env) {
|
||||
var msg
|
||||
|
||||
if (env !== 'production') {
|
||||
// use err.stack, which typically includes err.message
|
||||
msg = err.stack
|
||||
|
||||
// fallback to err.toString() when possible
|
||||
if (!msg && typeof err.toString === 'function') {
|
||||
msg = err.toString()
|
||||
}
|
||||
}
|
||||
|
||||
return msg || statuses[status]
|
||||
}
|
||||
|
||||
/**
|
||||
* Get status code from Error object.
|
||||
*
|
||||
* @param {Error} err
|
||||
* @return {number}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function getErrorStatusCode (err) {
|
||||
// check err.status
|
||||
if (typeof err.status === 'number' && err.status >= 400 && err.status < 600) {
|
||||
return err.status
|
||||
}
|
||||
|
||||
// check err.statusCode
|
||||
if (typeof err.statusCode === 'number' && err.statusCode >= 400 && err.statusCode < 600) {
|
||||
return err.statusCode
|
||||
}
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Get status code from response.
|
||||
*
|
||||
* @param {OutgoingMessage} res
|
||||
* @return {number}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function getResponseStatusCode (res) {
|
||||
var status = res.statusCode
|
||||
|
||||
// default status code to 500 if outside valid range
|
||||
if (typeof status !== 'number' || status < 400 || status > 599) {
|
||||
status = 500
|
||||
}
|
||||
|
||||
return status
|
||||
}
|
||||
|
||||
/**
|
||||
* Send response.
|
||||
*
|
||||
* @param {IncomingMessage} req
|
||||
* @param {OutgoingMessage} res
|
||||
* @param {number} status
|
||||
* @param {object} headers
|
||||
* @param {string} message
|
||||
* @private
|
||||
*/
|
||||
|
||||
function send (req, res, status, headers, message) {
|
||||
function write () {
|
||||
// response body
|
||||
var body = createHtmlDocument(message)
|
||||
|
||||
// response status
|
||||
res.statusCode = status
|
||||
res.statusMessage = statuses[status]
|
||||
|
||||
// response headers
|
||||
setHeaders(res, headers)
|
||||
|
||||
// security headers
|
||||
res.setHeader('Content-Security-Policy', "default-src 'self'")
|
||||
res.setHeader('X-Content-Type-Options', 'nosniff')
|
||||
|
||||
// standard headers
|
||||
res.setHeader('Content-Type', 'text/html; charset=utf-8')
|
||||
res.setHeader('Content-Length', Buffer.byteLength(body, 'utf8'))
|
||||
|
||||
if (req.method === 'HEAD') {
|
||||
res.end()
|
||||
return
|
||||
}
|
||||
|
||||
res.end(body, 'utf8')
|
||||
}
|
||||
|
||||
if (isFinished(req)) {
|
||||
write()
|
||||
return
|
||||
}
|
||||
|
||||
// unpipe everything from the request
|
||||
unpipe(req)
|
||||
|
||||
// flush the request
|
||||
onFinished(req, write)
|
||||
req.resume()
|
||||
}
|
||||
|
||||
/**
|
||||
* Set response headers from an object.
|
||||
*
|
||||
* @param {OutgoingMessage} res
|
||||
* @param {object} headers
|
||||
* @private
|
||||
*/
|
||||
|
||||
function setHeaders (res, headers) {
|
||||
if (!headers) {
|
||||
return
|
||||
}
|
||||
|
||||
var keys = Object.keys(headers)
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i]
|
||||
res.setHeader(key, headers[key])
|
||||
}
|
||||
}
|
55
express-server/node_modules/finalhandler/node_modules/statuses/HISTORY.md
generated
vendored
Normal file
55
express-server/node_modules/finalhandler/node_modules/statuses/HISTORY.md
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
1.3.1 / 2016-11-11
|
||||
==================
|
||||
|
||||
* Fix return type in JSDoc
|
||||
|
||||
1.3.0 / 2016-05-17
|
||||
==================
|
||||
|
||||
* Add `421 Misdirected Request`
|
||||
* perf: enable strict mode
|
||||
|
||||
1.2.1 / 2015-02-01
|
||||
==================
|
||||
|
||||
* Fix message for status 451
|
||||
- `451 Unavailable For Legal Reasons`
|
||||
|
||||
1.2.0 / 2014-09-28
|
||||
==================
|
||||
|
||||
* Add `208 Already Repored`
|
||||
* Add `226 IM Used`
|
||||
* Add `306 (Unused)`
|
||||
* Add `415 Unable For Legal Reasons`
|
||||
* Add `508 Loop Detected`
|
||||
|
||||
1.1.1 / 2014-09-24
|
||||
==================
|
||||
|
||||
* Add missing 308 to `codes.json`
|
||||
|
||||
1.1.0 / 2014-09-21
|
||||
==================
|
||||
|
||||
* Add `codes.json` for universal support
|
||||
|
||||
1.0.4 / 2014-08-20
|
||||
==================
|
||||
|
||||
* Package cleanup
|
||||
|
||||
1.0.3 / 2014-06-08
|
||||
==================
|
||||
|
||||
* Add 308 to `.redirect` category
|
||||
|
||||
1.0.2 / 2014-03-13
|
||||
==================
|
||||
|
||||
* Add `.retry` category
|
||||
|
||||
1.0.1 / 2014-03-12
|
||||
==================
|
||||
|
||||
* Initial release
|
23
express-server/node_modules/finalhandler/node_modules/statuses/LICENSE
generated
vendored
Normal file
23
express-server/node_modules/finalhandler/node_modules/statuses/LICENSE
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
|
||||
Copyright (c) 2016 Douglas Christopher Wilson doug@somethingdoug.com
|
||||
|
||||
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.
|
103
express-server/node_modules/finalhandler/node_modules/statuses/README.md
generated
vendored
Normal file
103
express-server/node_modules/finalhandler/node_modules/statuses/README.md
generated
vendored
Normal file
@ -0,0 +1,103 @@
|
||||
# Statuses
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
HTTP status utility for node.
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var status = require('statuses')
|
||||
```
|
||||
|
||||
### var code = status(Integer || String)
|
||||
|
||||
If `Integer` or `String` is a valid HTTP code or status message, then the appropriate `code` will be returned. Otherwise, an error will be thrown.
|
||||
|
||||
```js
|
||||
status(403) // => 403
|
||||
status('403') // => 403
|
||||
status('forbidden') // => 403
|
||||
status('Forbidden') // => 403
|
||||
status(306) // throws, as it's not supported by node.js
|
||||
```
|
||||
|
||||
### status.codes
|
||||
|
||||
Returns an array of all the status codes as `Integer`s.
|
||||
|
||||
### var msg = status[code]
|
||||
|
||||
Map of `code` to `status message`. `undefined` for invalid `code`s.
|
||||
|
||||
```js
|
||||
status[404] // => 'Not Found'
|
||||
```
|
||||
|
||||
### var code = status[msg]
|
||||
|
||||
Map of `status message` to `code`. `msg` can either be title-cased or lower-cased. `undefined` for invalid `status message`s.
|
||||
|
||||
```js
|
||||
status['not found'] // => 404
|
||||
status['Not Found'] // => 404
|
||||
```
|
||||
|
||||
### status.redirect[code]
|
||||
|
||||
Returns `true` if a status code is a valid redirect status.
|
||||
|
||||
```js
|
||||
status.redirect[200] // => undefined
|
||||
status.redirect[301] // => true
|
||||
```
|
||||
|
||||
### status.empty[code]
|
||||
|
||||
Returns `true` if a status code expects an empty body.
|
||||
|
||||
```js
|
||||
status.empty[200] // => undefined
|
||||
status.empty[204] // => true
|
||||
status.empty[304] // => true
|
||||
```
|
||||
|
||||
### status.retry[code]
|
||||
|
||||
Returns `true` if you should retry the rest.
|
||||
|
||||
```js
|
||||
status.retry[501] // => undefined
|
||||
status.retry[503] // => true
|
||||
```
|
||||
|
||||
## Adding Status Codes
|
||||
|
||||
The status codes are primarily sourced from http://www.iana.org/assignments/http-status-codes/http-status-codes-1.csv.
|
||||
Additionally, custom codes are added from http://en.wikipedia.org/wiki/List_of_HTTP_status_codes.
|
||||
These are added manually in the `lib/*.json` files.
|
||||
If you would like to add a status code, add it to the appropriate JSON file.
|
||||
|
||||
To rebuild `codes.json`, run the following:
|
||||
|
||||
```bash
|
||||
# update src/iana.json
|
||||
npm run fetch
|
||||
# build codes.json
|
||||
npm run build
|
||||
```
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/statuses.svg
|
||||
[npm-url]: https://npmjs.org/package/statuses
|
||||
[node-version-image]: https://img.shields.io/badge/node.js-%3E%3D_0.6-brightgreen.svg
|
||||
[node-version-url]: https://nodejs.org/en/download
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/statuses.svg
|
||||
[travis-url]: https://travis-ci.org/jshttp/statuses
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/statuses.svg
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/statuses?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/statuses.svg
|
||||
[downloads-url]: https://npmjs.org/package/statuses
|
65
express-server/node_modules/finalhandler/node_modules/statuses/codes.json
generated
vendored
Normal file
65
express-server/node_modules/finalhandler/node_modules/statuses/codes.json
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
{
|
||||
"100": "Continue",
|
||||
"101": "Switching Protocols",
|
||||
"102": "Processing",
|
||||
"200": "OK",
|
||||
"201": "Created",
|
||||
"202": "Accepted",
|
||||
"203": "Non-Authoritative Information",
|
||||
"204": "No Content",
|
||||
"205": "Reset Content",
|
||||
"206": "Partial Content",
|
||||
"207": "Multi-Status",
|
||||
"208": "Already Reported",
|
||||
"226": "IM Used",
|
||||
"300": "Multiple Choices",
|
||||
"301": "Moved Permanently",
|
||||
"302": "Found",
|
||||
"303": "See Other",
|
||||
"304": "Not Modified",
|
||||
"305": "Use Proxy",
|
||||
"306": "(Unused)",
|
||||
"307": "Temporary Redirect",
|
||||
"308": "Permanent Redirect",
|
||||
"400": "Bad Request",
|
||||
"401": "Unauthorized",
|
||||
"402": "Payment Required",
|
||||
"403": "Forbidden",
|
||||
"404": "Not Found",
|
||||
"405": "Method Not Allowed",
|
||||
"406": "Not Acceptable",
|
||||
"407": "Proxy Authentication Required",
|
||||
"408": "Request Timeout",
|
||||
"409": "Conflict",
|
||||
"410": "Gone",
|
||||
"411": "Length Required",
|
||||
"412": "Precondition Failed",
|
||||
"413": "Payload Too Large",
|
||||
"414": "URI Too Long",
|
||||
"415": "Unsupported Media Type",
|
||||
"416": "Range Not Satisfiable",
|
||||
"417": "Expectation Failed",
|
||||
"418": "I'm a teapot",
|
||||
"421": "Misdirected Request",
|
||||
"422": "Unprocessable Entity",
|
||||
"423": "Locked",
|
||||
"424": "Failed Dependency",
|
||||
"425": "Unordered Collection",
|
||||
"426": "Upgrade Required",
|
||||
"428": "Precondition Required",
|
||||
"429": "Too Many Requests",
|
||||
"431": "Request Header Fields Too Large",
|
||||
"451": "Unavailable For Legal Reasons",
|
||||
"500": "Internal Server Error",
|
||||
"501": "Not Implemented",
|
||||
"502": "Bad Gateway",
|
||||
"503": "Service Unavailable",
|
||||
"504": "Gateway Timeout",
|
||||
"505": "HTTP Version Not Supported",
|
||||
"506": "Variant Also Negotiates",
|
||||
"507": "Insufficient Storage",
|
||||
"508": "Loop Detected",
|
||||
"509": "Bandwidth Limit Exceeded",
|
||||
"510": "Not Extended",
|
||||
"511": "Network Authentication Required"
|
||||
}
|
110
express-server/node_modules/finalhandler/node_modules/statuses/index.js
generated
vendored
Normal file
110
express-server/node_modules/finalhandler/node_modules/statuses/index.js
generated
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
/*!
|
||||
* statuses
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2016 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var codes = require('./codes.json')
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = status
|
||||
|
||||
// array of status codes
|
||||
status.codes = populateStatusesMap(status, codes)
|
||||
|
||||
// status codes for redirects
|
||||
status.redirect = {
|
||||
300: true,
|
||||
301: true,
|
||||
302: true,
|
||||
303: true,
|
||||
305: true,
|
||||
307: true,
|
||||
308: true
|
||||
}
|
||||
|
||||
// status codes for empty bodies
|
||||
status.empty = {
|
||||
204: true,
|
||||
205: true,
|
||||
304: true
|
||||
}
|
||||
|
||||
// status codes for when you should retry the request
|
||||
status.retry = {
|
||||
502: true,
|
||||
503: true,
|
||||
504: true
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the statuses map for given codes.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function populateStatusesMap (statuses, codes) {
|
||||
var arr = []
|
||||
|
||||
Object.keys(codes).forEach(function forEachCode (code) {
|
||||
var message = codes[code]
|
||||
var status = Number(code)
|
||||
|
||||
// Populate properties
|
||||
statuses[status] = message
|
||||
statuses[message] = status
|
||||
statuses[message.toLowerCase()] = status
|
||||
|
||||
// Add to array
|
||||
arr.push(status)
|
||||
})
|
||||
|
||||
return arr
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the status code.
|
||||
*
|
||||
* Given a number, this will throw if it is not a known status
|
||||
* code, otherwise the code will be returned. Given a string,
|
||||
* the string will be parsed for a number and return the code
|
||||
* if valid, otherwise will lookup the code assuming this is
|
||||
* the status message.
|
||||
*
|
||||
* @param {string|number} code
|
||||
* @returns {number}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function status (code) {
|
||||
if (typeof code === 'number') {
|
||||
if (!status[code]) throw new Error('invalid status code: ' + code)
|
||||
return code
|
||||
}
|
||||
|
||||
if (typeof code !== 'string') {
|
||||
throw new TypeError('code must be a number or string')
|
||||
}
|
||||
|
||||
// '403'
|
||||
var n = parseInt(code, 10)
|
||||
if (!isNaN(n)) {
|
||||
if (!status[n]) throw new Error('invalid status code: ' + n)
|
||||
return n
|
||||
}
|
||||
|
||||
n = status[code.toLowerCase()]
|
||||
if (!n) throw new Error('invalid status message: "' + code + '"')
|
||||
return n
|
||||
}
|
83
express-server/node_modules/finalhandler/node_modules/statuses/package.json
generated
vendored
Normal file
83
express-server/node_modules/finalhandler/node_modules/statuses/package.json
generated
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
{
|
||||
"_from": "statuses@~1.3.1",
|
||||
"_id": "statuses@1.3.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=",
|
||||
"_location": "/finalhandler/statuses",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "statuses@~1.3.1",
|
||||
"name": "statuses",
|
||||
"escapedName": "statuses",
|
||||
"rawSpec": "~1.3.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~1.3.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/finalhandler"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz",
|
||||
"_shasum": "faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e",
|
||||
"_spec": "statuses@~1.3.1",
|
||||
"_where": "D:\\5CHITM\\Diplomarbeit\\smart-shopper\\express-server\\node_modules\\finalhandler",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/statuses/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Ong",
|
||||
"email": "me@jongleberry.com",
|
||||
"url": "http://jongleberry.com"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "HTTP status utility",
|
||||
"devDependencies": {
|
||||
"csv-parse": "1.1.7",
|
||||
"eslint": "3.10.0",
|
||||
"eslint-config-standard": "6.2.1",
|
||||
"eslint-plugin-promise": "3.3.2",
|
||||
"eslint-plugin-standard": "2.0.1",
|
||||
"istanbul": "0.4.5",
|
||||
"mocha": "1.21.5",
|
||||
"stream-to-array": "2.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"index.js",
|
||||
"codes.json",
|
||||
"LICENSE"
|
||||
],
|
||||
"homepage": "https://github.com/jshttp/statuses#readme",
|
||||
"keywords": [
|
||||
"http",
|
||||
"status",
|
||||
"code"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "statuses",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jshttp/statuses.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node scripts/build.js",
|
||||
"fetch": "node scripts/fetch.js",
|
||||
"lint": "eslint .",
|
||||
"test": "mocha --reporter spec --check-leaks --bail test/",
|
||||
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
||||
"update": "npm run fetch && npm run build"
|
||||
},
|
||||
"version": "1.3.1"
|
||||
}
|
80
express-server/node_modules/finalhandler/package.json
generated
vendored
Normal file
80
express-server/node_modules/finalhandler/package.json
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
{
|
||||
"_from": "finalhandler@~1.0.6",
|
||||
"_id": "finalhandler@1.0.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-AHrqM9Gk0+QgF/YkhIrVjSEvgU8=",
|
||||
"_location": "/finalhandler",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "finalhandler@~1.0.6",
|
||||
"name": "finalhandler",
|
||||
"escapedName": "finalhandler",
|
||||
"rawSpec": "~1.0.6",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~1.0.6"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/express"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.0.6.tgz",
|
||||
"_shasum": "007aea33d1a4d3e42017f624848ad58d212f814f",
|
||||
"_spec": "finalhandler@~1.0.6",
|
||||
"_where": "D:\\5CHITM\\Diplomarbeit\\smart-shopper\\express-server\\node_modules\\express",
|
||||
"author": {
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/pillarjs/finalhandler/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"debug": "2.6.9",
|
||||
"encodeurl": "~1.0.1",
|
||||
"escape-html": "~1.0.3",
|
||||
"on-finished": "~2.3.0",
|
||||
"parseurl": "~1.3.2",
|
||||
"statuses": "~1.3.1",
|
||||
"unpipe": "~1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Node.js final http responder",
|
||||
"devDependencies": {
|
||||
"eslint": "3.19.0",
|
||||
"eslint-config-standard": "10.2.1",
|
||||
"eslint-plugin-import": "2.7.0",
|
||||
"eslint-plugin-markdown": "1.0.0-beta.6",
|
||||
"eslint-plugin-node": "5.1.1",
|
||||
"eslint-plugin-promise": "3.5.0",
|
||||
"eslint-plugin-standard": "3.0.1",
|
||||
"istanbul": "0.4.5",
|
||||
"mocha": "2.5.3",
|
||||
"readable-stream": "2.3.3",
|
||||
"safe-buffer": "5.1.1",
|
||||
"supertest": "1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"HISTORY.md",
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/pillarjs/finalhandler#readme",
|
||||
"license": "MIT",
|
||||
"name": "finalhandler",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/pillarjs/finalhandler.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --plugin markdown --ext js,md .",
|
||||
"test": "mocha --reporter spec --bail --check-leaks test/",
|
||||
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/"
|
||||
},
|
||||
"version": "1.0.6"
|
||||
}
|
Reference in New Issue
Block a user