step-node-agent 3.29.1 → 3.29.3-customJava25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/har-validator/node_modules/ajv/README.md +14 -6
- package/node_modules/har-validator/node_modules/ajv/dist/ajv.bundle.js +23 -11
- package/node_modules/har-validator/node_modules/ajv/dist/ajv.min.js +2 -2
- package/node_modules/har-validator/node_modules/ajv/dist/ajv.min.js.map +1 -1
- package/node_modules/har-validator/node_modules/ajv/lib/ajv.d.ts +5 -0
- package/node_modules/har-validator/node_modules/ajv/lib/compile/index.js +8 -6
- package/node_modules/har-validator/node_modules/ajv/lib/dot/pattern.jst +15 -4
- package/node_modules/har-validator/node_modules/ajv/lib/dotjs/pattern.js +14 -4
- package/node_modules/har-validator/node_modules/ajv/package.json +2 -1
- package/node_modules/har-validator/node_modules/ajv/scripts/info +0 -0
- package/node_modules/har-validator/node_modules/ajv/scripts/prepare-tests +0 -0
- package/node_modules/har-validator/node_modules/ajv/scripts/publish-built-version +0 -0
- package/node_modules/har-validator/node_modules/ajv/scripts/travis-gh-pages +0 -0
- package/node_modules/minimatch/README.md +37 -0
- package/node_modules/minimatch/minimatch.js +160 -102
- package/node_modules/minimatch/package.json +2 -2
- package/node_modules/qs/.editorconfig +1 -1
- package/node_modules/qs/.github/SECURITY.md +11 -0
- package/node_modules/qs/.github/THREAT_MODEL.md +78 -0
- package/node_modules/qs/CHANGELOG.md +22 -0
- package/node_modules/qs/README.md +11 -4
- package/node_modules/qs/dist/qs.js +24 -24
- package/node_modules/qs/eslint.config.mjs +56 -0
- package/node_modules/qs/lib/parse.js +90 -47
- package/node_modules/qs/lib/utils.js +83 -11
- package/node_modules/qs/package.json +9 -8
- package/node_modules/qs/test/parse.js +245 -9
- package/node_modules/qs/test/stringify.js +7 -3
- package/node_modules/qs/test/utils.js +135 -0
- package/node_modules/request/node_modules/qs/CHANGELOG.md +12 -0
- package/node_modules/request/node_modules/qs/README.md +9 -3
- package/node_modules/request/node_modules/qs/dist/qs.js +10 -10
- package/node_modules/request/node_modules/qs/lib/parse.js +4 -4
- package/node_modules/request/node_modules/qs/lib/utils.js +6 -6
- package/node_modules/request/node_modules/qs/package.json +13 -4
- package/node_modules/request/node_modules/qs/test/parse.js +9 -0
- package/node_modules/request/node_modules/qs/test/stringify.js +6 -0
- package/node_modules/send/HISTORY.md +7 -0
- package/node_modules/send/package.json +5 -5
- package/node_modules/serve-static/HISTORY.md +6 -0
- package/node_modules/serve-static/package.json +2 -2
- package/node_modules/underscore/amd/_setup.js +1 -1
- package/node_modules/underscore/amd/pipe.js +13 -0
- package/node_modules/underscore/cjs/_setup.js +1 -1
- package/node_modules/underscore/cjs/pipe.js +12 -0
- package/node_modules/underscore/modules/_flatten.js +20 -18
- package/node_modules/underscore/modules/_setup.js +1 -1
- package/node_modules/underscore/modules/index.js +2 -2
- package/node_modules/underscore/modules/isEqual.js +108 -93
- package/node_modules/underscore/modules/package.json +1 -1
- package/node_modules/underscore/package.json +1 -1
- package/node_modules/underscore/underscore-esm-min.js +3 -3
- package/node_modules/underscore/underscore-esm-min.js.map +1 -1
- package/node_modules/underscore/underscore-esm.js +132 -115
- package/node_modules/underscore/underscore-esm.js.map +1 -1
- package/node_modules/underscore/underscore-min.js +3 -3
- package/node_modules/underscore/underscore-min.js.map +1 -1
- package/node_modules/underscore/underscore-node-f.cjs +132 -115
- package/node_modules/underscore/underscore-node-f.cjs.map +1 -1
- package/node_modules/underscore/underscore-node.cjs +2 -2
- package/node_modules/underscore/underscore-node.mjs +2 -2
- package/node_modules/underscore/underscore-umd-min.js +3 -3
- package/node_modules/underscore/underscore-umd-min.js.map +1 -1
- package/node_modules/underscore/underscore-umd.js +132 -115
- package/node_modules/underscore/underscore-umd.js.map +1 -1
- package/node_modules/underscore/underscore.js +132 -115
- package/package.json +1 -1
- package/node_modules/qs/.eslintrc +0 -39
- package/node_modules/request/node_modules/qs/bower.json +0 -21
- package/node_modules/request/node_modules/qs/component.json +0 -15
- package/node_modules/send/node_modules/http-errors/HISTORY.md +0 -180
- package/node_modules/send/node_modules/http-errors/LICENSE +0 -23
- package/node_modules/send/node_modules/http-errors/README.md +0 -169
- package/node_modules/send/node_modules/http-errors/index.js +0 -289
- package/node_modules/send/node_modules/http-errors/package.json +0 -50
- package/node_modules/send/node_modules/statuses/HISTORY.md +0 -82
- package/node_modules/send/node_modules/statuses/LICENSE +0 -23
- package/node_modules/send/node_modules/statuses/README.md +0 -136
- package/node_modules/send/node_modules/statuses/codes.json +0 -65
- package/node_modules/send/node_modules/statuses/index.js +0 -146
- package/node_modules/send/node_modules/statuses/package.json +0 -49
- package/node_modules/serve-static/node_modules/http-errors/HISTORY.md +0 -180
- package/node_modules/serve-static/node_modules/http-errors/LICENSE +0 -23
- package/node_modules/serve-static/node_modules/http-errors/README.md +0 -169
- package/node_modules/serve-static/node_modules/http-errors/index.js +0 -289
- package/node_modules/serve-static/node_modules/http-errors/package.json +0 -50
- package/node_modules/serve-static/node_modules/ms/index.js +0 -162
- package/node_modules/serve-static/node_modules/ms/license.md +0 -21
- package/node_modules/serve-static/node_modules/ms/package.json +0 -38
- package/node_modules/serve-static/node_modules/ms/readme.md +0 -59
- package/node_modules/serve-static/node_modules/send/HISTORY.md +0 -526
- package/node_modules/serve-static/node_modules/send/LICENSE +0 -23
- package/node_modules/serve-static/node_modules/send/README.md +0 -327
- package/node_modules/serve-static/node_modules/send/SECURITY.md +0 -24
- package/node_modules/serve-static/node_modules/send/index.js +0 -1142
- package/node_modules/serve-static/node_modules/send/node_modules/encodeurl/HISTORY.md +0 -14
- package/node_modules/serve-static/node_modules/send/node_modules/encodeurl/LICENSE +0 -22
- package/node_modules/serve-static/node_modules/send/node_modules/encodeurl/README.md +0 -128
- package/node_modules/serve-static/node_modules/send/node_modules/encodeurl/index.js +0 -60
- package/node_modules/serve-static/node_modules/send/node_modules/encodeurl/package.json +0 -40
- package/node_modules/serve-static/node_modules/send/package.json +0 -62
- package/node_modules/serve-static/node_modules/statuses/HISTORY.md +0 -82
- package/node_modules/serve-static/node_modules/statuses/LICENSE +0 -23
- package/node_modules/serve-static/node_modules/statuses/README.md +0 -136
- package/node_modules/serve-static/node_modules/statuses/codes.json +0 -65
- package/node_modules/serve-static/node_modules/statuses/index.js +0 -146
- package/node_modules/serve-static/node_modules/statuses/package.json +0 -49
- package/node_modules/underscore/amd/_set.js +0 -21
- package/node_modules/underscore/amd/set.js +0 -15
- package/node_modules/underscore/cjs/_set.js +0 -21
- package/node_modules/underscore/cjs/set.js +0 -15
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* statuses
|
|
3
|
-
* Copyright(c) 2014 Jonathan Ong
|
|
4
|
-
* Copyright(c) 2016 Douglas Christopher Wilson
|
|
5
|
-
* MIT Licensed
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
'use strict'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Module dependencies.
|
|
12
|
-
* @private
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
var codes = require('./codes.json')
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Module exports.
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
module.exports = status
|
|
23
|
-
|
|
24
|
-
// status code to message map
|
|
25
|
-
status.message = codes
|
|
26
|
-
|
|
27
|
-
// status message (lower-case) to code map
|
|
28
|
-
status.code = createMessageToStatusCodeMap(codes)
|
|
29
|
-
|
|
30
|
-
// array of status codes
|
|
31
|
-
status.codes = createStatusCodeList(codes)
|
|
32
|
-
|
|
33
|
-
// status codes for redirects
|
|
34
|
-
status.redirect = {
|
|
35
|
-
300: true,
|
|
36
|
-
301: true,
|
|
37
|
-
302: true,
|
|
38
|
-
303: true,
|
|
39
|
-
305: true,
|
|
40
|
-
307: true,
|
|
41
|
-
308: true
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// status codes for empty bodies
|
|
45
|
-
status.empty = {
|
|
46
|
-
204: true,
|
|
47
|
-
205: true,
|
|
48
|
-
304: true
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// status codes for when you should retry the request
|
|
52
|
-
status.retry = {
|
|
53
|
-
502: true,
|
|
54
|
-
503: true,
|
|
55
|
-
504: true
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Create a map of message to status code.
|
|
60
|
-
* @private
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
function createMessageToStatusCodeMap (codes) {
|
|
64
|
-
var map = {}
|
|
65
|
-
|
|
66
|
-
Object.keys(codes).forEach(function forEachCode (code) {
|
|
67
|
-
var message = codes[code]
|
|
68
|
-
var status = Number(code)
|
|
69
|
-
|
|
70
|
-
// populate map
|
|
71
|
-
map[message.toLowerCase()] = status
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
return map
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Create a list of all status codes.
|
|
79
|
-
* @private
|
|
80
|
-
*/
|
|
81
|
-
|
|
82
|
-
function createStatusCodeList (codes) {
|
|
83
|
-
return Object.keys(codes).map(function mapCode (code) {
|
|
84
|
-
return Number(code)
|
|
85
|
-
})
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Get the status code for given message.
|
|
90
|
-
* @private
|
|
91
|
-
*/
|
|
92
|
-
|
|
93
|
-
function getStatusCode (message) {
|
|
94
|
-
var msg = message.toLowerCase()
|
|
95
|
-
|
|
96
|
-
if (!Object.prototype.hasOwnProperty.call(status.code, msg)) {
|
|
97
|
-
throw new Error('invalid status message: "' + message + '"')
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return status.code[msg]
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Get the status message for given code.
|
|
105
|
-
* @private
|
|
106
|
-
*/
|
|
107
|
-
|
|
108
|
-
function getStatusMessage (code) {
|
|
109
|
-
if (!Object.prototype.hasOwnProperty.call(status.message, code)) {
|
|
110
|
-
throw new Error('invalid status code: ' + code)
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return status.message[code]
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Get the status code.
|
|
118
|
-
*
|
|
119
|
-
* Given a number, this will throw if it is not a known status
|
|
120
|
-
* code, otherwise the code will be returned. Given a string,
|
|
121
|
-
* the string will be parsed for a number and return the code
|
|
122
|
-
* if valid, otherwise will lookup the code assuming this is
|
|
123
|
-
* the status message.
|
|
124
|
-
*
|
|
125
|
-
* @param {string|number} code
|
|
126
|
-
* @returns {number}
|
|
127
|
-
* @public
|
|
128
|
-
*/
|
|
129
|
-
|
|
130
|
-
function status (code) {
|
|
131
|
-
if (typeof code === 'number') {
|
|
132
|
-
return getStatusMessage(code)
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (typeof code !== 'string') {
|
|
136
|
-
throw new TypeError('code must be a number or string')
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// '403'
|
|
140
|
-
var n = parseInt(code, 10)
|
|
141
|
-
if (!isNaN(n)) {
|
|
142
|
-
return getStatusMessage(n)
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return getStatusCode(code)
|
|
146
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "statuses",
|
|
3
|
-
"description": "HTTP status utility",
|
|
4
|
-
"version": "2.0.1",
|
|
5
|
-
"contributors": [
|
|
6
|
-
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
|
7
|
-
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
|
|
8
|
-
],
|
|
9
|
-
"repository": "jshttp/statuses",
|
|
10
|
-
"license": "MIT",
|
|
11
|
-
"keywords": [
|
|
12
|
-
"http",
|
|
13
|
-
"status",
|
|
14
|
-
"code"
|
|
15
|
-
],
|
|
16
|
-
"files": [
|
|
17
|
-
"HISTORY.md",
|
|
18
|
-
"index.js",
|
|
19
|
-
"codes.json",
|
|
20
|
-
"LICENSE"
|
|
21
|
-
],
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"csv-parse": "4.14.2",
|
|
24
|
-
"eslint": "7.17.0",
|
|
25
|
-
"eslint-config-standard": "14.1.1",
|
|
26
|
-
"eslint-plugin-import": "2.22.1",
|
|
27
|
-
"eslint-plugin-markdown": "1.0.2",
|
|
28
|
-
"eslint-plugin-node": "11.1.0",
|
|
29
|
-
"eslint-plugin-promise": "4.2.1",
|
|
30
|
-
"eslint-plugin-standard": "4.1.0",
|
|
31
|
-
"mocha": "8.2.1",
|
|
32
|
-
"nyc": "15.1.0",
|
|
33
|
-
"raw-body": "2.4.1",
|
|
34
|
-
"stream-to-array": "2.3.0"
|
|
35
|
-
},
|
|
36
|
-
"engines": {
|
|
37
|
-
"node": ">= 0.8"
|
|
38
|
-
},
|
|
39
|
-
"scripts": {
|
|
40
|
-
"build": "node scripts/build.js",
|
|
41
|
-
"fetch": "node scripts/fetch-apache.js && node scripts/fetch-iana.js && node scripts/fetch-nginx.js && node scripts/fetch-node.js",
|
|
42
|
-
"lint": "eslint --plugin markdown --ext js,md .",
|
|
43
|
-
"test": "mocha --reporter spec --check-leaks --bail test/",
|
|
44
|
-
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
|
45
|
-
"test-cov": "nyc --reporter=html --reporter=text npm test",
|
|
46
|
-
"update": "npm run fetch && npm run build",
|
|
47
|
-
"version": "node scripts/version-history.js && git add HISTORY.md"
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
2.0.0 / 2021-12-17
|
|
2
|
-
==================
|
|
3
|
-
|
|
4
|
-
* Drop support for Node.js 0.6
|
|
5
|
-
* Remove `I'mateapot` export; use `ImATeapot` instead
|
|
6
|
-
* Remove support for status being non-first argument
|
|
7
|
-
* Rename `UnorderedCollection` constructor to `TooEarly`
|
|
8
|
-
* deps: depd@2.0.0
|
|
9
|
-
- Replace internal `eval` usage with `Function` constructor
|
|
10
|
-
- Use instance methods on `process` to check for listeners
|
|
11
|
-
* deps: statuses@2.0.1
|
|
12
|
-
- Fix messaging casing of `418 I'm a Teapot`
|
|
13
|
-
- Remove code 306
|
|
14
|
-
- Rename `425 Unordered Collection` to standard `425 Too Early`
|
|
15
|
-
|
|
16
|
-
2021-11-14 / 1.8.1
|
|
17
|
-
==================
|
|
18
|
-
|
|
19
|
-
* deps: toidentifier@1.0.1
|
|
20
|
-
|
|
21
|
-
2020-06-29 / 1.8.0
|
|
22
|
-
==================
|
|
23
|
-
|
|
24
|
-
* Add `isHttpError` export to determine if value is an HTTP error
|
|
25
|
-
* deps: setprototypeof@1.2.0
|
|
26
|
-
|
|
27
|
-
2019-06-24 / 1.7.3
|
|
28
|
-
==================
|
|
29
|
-
|
|
30
|
-
* deps: inherits@2.0.4
|
|
31
|
-
|
|
32
|
-
2019-02-18 / 1.7.2
|
|
33
|
-
==================
|
|
34
|
-
|
|
35
|
-
* deps: setprototypeof@1.1.1
|
|
36
|
-
|
|
37
|
-
2018-09-08 / 1.7.1
|
|
38
|
-
==================
|
|
39
|
-
|
|
40
|
-
* Fix error creating objects in some environments
|
|
41
|
-
|
|
42
|
-
2018-07-30 / 1.7.0
|
|
43
|
-
==================
|
|
44
|
-
|
|
45
|
-
* Set constructor name when possible
|
|
46
|
-
* Use `toidentifier` module to make class names
|
|
47
|
-
* deps: statuses@'>= 1.5.0 < 2'
|
|
48
|
-
|
|
49
|
-
2018-03-29 / 1.6.3
|
|
50
|
-
==================
|
|
51
|
-
|
|
52
|
-
* deps: depd@~1.1.2
|
|
53
|
-
- perf: remove argument reassignment
|
|
54
|
-
* deps: setprototypeof@1.1.0
|
|
55
|
-
* deps: statuses@'>= 1.4.0 < 2'
|
|
56
|
-
|
|
57
|
-
2017-08-04 / 1.6.2
|
|
58
|
-
==================
|
|
59
|
-
|
|
60
|
-
* deps: depd@1.1.1
|
|
61
|
-
- Remove unnecessary `Buffer` loading
|
|
62
|
-
|
|
63
|
-
2017-02-20 / 1.6.1
|
|
64
|
-
==================
|
|
65
|
-
|
|
66
|
-
* deps: setprototypeof@1.0.3
|
|
67
|
-
- Fix shim for old browsers
|
|
68
|
-
|
|
69
|
-
2017-02-14 / 1.6.0
|
|
70
|
-
==================
|
|
71
|
-
|
|
72
|
-
* Accept custom 4xx and 5xx status codes in factory
|
|
73
|
-
* Add deprecation message to `"I'mateapot"` export
|
|
74
|
-
* Deprecate passing status code as anything except first argument in factory
|
|
75
|
-
* Deprecate using non-error status codes
|
|
76
|
-
* Make `message` property enumerable for `HttpError`s
|
|
77
|
-
|
|
78
|
-
2016-11-16 / 1.5.1
|
|
79
|
-
==================
|
|
80
|
-
|
|
81
|
-
* deps: inherits@2.0.3
|
|
82
|
-
- Fix issue loading in browser
|
|
83
|
-
* deps: setprototypeof@1.0.2
|
|
84
|
-
* deps: statuses@'>= 1.3.1 < 2'
|
|
85
|
-
|
|
86
|
-
2016-05-18 / 1.5.0
|
|
87
|
-
==================
|
|
88
|
-
|
|
89
|
-
* Support new code `421 Misdirected Request`
|
|
90
|
-
* Use `setprototypeof` module to replace `__proto__` setting
|
|
91
|
-
* deps: statuses@'>= 1.3.0 < 2'
|
|
92
|
-
- Add `421 Misdirected Request`
|
|
93
|
-
- perf: enable strict mode
|
|
94
|
-
* perf: enable strict mode
|
|
95
|
-
|
|
96
|
-
2016-01-28 / 1.4.0
|
|
97
|
-
==================
|
|
98
|
-
|
|
99
|
-
* Add `HttpError` export, for `err instanceof createError.HttpError`
|
|
100
|
-
* deps: inherits@2.0.1
|
|
101
|
-
* deps: statuses@'>= 1.2.1 < 2'
|
|
102
|
-
- Fix message for status 451
|
|
103
|
-
- Remove incorrect nginx status code
|
|
104
|
-
|
|
105
|
-
2015-02-02 / 1.3.1
|
|
106
|
-
==================
|
|
107
|
-
|
|
108
|
-
* Fix regression where status can be overwritten in `createError` `props`
|
|
109
|
-
|
|
110
|
-
2015-02-01 / 1.3.0
|
|
111
|
-
==================
|
|
112
|
-
|
|
113
|
-
* Construct errors using defined constructors from `createError`
|
|
114
|
-
* Fix error names that are not identifiers
|
|
115
|
-
- `createError["I'mateapot"]` is now `createError.ImATeapot`
|
|
116
|
-
* Set a meaningful `name` property on constructed errors
|
|
117
|
-
|
|
118
|
-
2014-12-09 / 1.2.8
|
|
119
|
-
==================
|
|
120
|
-
|
|
121
|
-
* Fix stack trace from exported function
|
|
122
|
-
* Remove `arguments.callee` usage
|
|
123
|
-
|
|
124
|
-
2014-10-14 / 1.2.7
|
|
125
|
-
==================
|
|
126
|
-
|
|
127
|
-
* Remove duplicate line
|
|
128
|
-
|
|
129
|
-
2014-10-02 / 1.2.6
|
|
130
|
-
==================
|
|
131
|
-
|
|
132
|
-
* Fix `expose` to be `true` for `ClientError` constructor
|
|
133
|
-
|
|
134
|
-
2014-09-28 / 1.2.5
|
|
135
|
-
==================
|
|
136
|
-
|
|
137
|
-
* deps: statuses@1
|
|
138
|
-
|
|
139
|
-
2014-09-21 / 1.2.4
|
|
140
|
-
==================
|
|
141
|
-
|
|
142
|
-
* Fix dependency version to work with old `npm`s
|
|
143
|
-
|
|
144
|
-
2014-09-21 / 1.2.3
|
|
145
|
-
==================
|
|
146
|
-
|
|
147
|
-
* deps: statuses@~1.1.0
|
|
148
|
-
|
|
149
|
-
2014-09-21 / 1.2.2
|
|
150
|
-
==================
|
|
151
|
-
|
|
152
|
-
* Fix publish error
|
|
153
|
-
|
|
154
|
-
2014-09-21 / 1.2.1
|
|
155
|
-
==================
|
|
156
|
-
|
|
157
|
-
* Support Node.js 0.6
|
|
158
|
-
* Use `inherits` instead of `util`
|
|
159
|
-
|
|
160
|
-
2014-09-09 / 1.2.0
|
|
161
|
-
==================
|
|
162
|
-
|
|
163
|
-
* Fix the way inheriting functions
|
|
164
|
-
* Support `expose` being provided in properties argument
|
|
165
|
-
|
|
166
|
-
2014-09-08 / 1.1.0
|
|
167
|
-
==================
|
|
168
|
-
|
|
169
|
-
* Default status to 500
|
|
170
|
-
* Support provided `error` to extend
|
|
171
|
-
|
|
172
|
-
2014-09-08 / 1.0.1
|
|
173
|
-
==================
|
|
174
|
-
|
|
175
|
-
* Fix accepting string message
|
|
176
|
-
|
|
177
|
-
2014-09-08 / 1.0.0
|
|
178
|
-
==================
|
|
179
|
-
|
|
180
|
-
* Initial release
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
The MIT License (MIT)
|
|
3
|
-
|
|
4
|
-
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
|
|
5
|
-
Copyright (c) 2016 Douglas Christopher Wilson doug@somethingdoug.com
|
|
6
|
-
|
|
7
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
in the Software without restriction, including without limitation the rights
|
|
10
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
furnished to do so, subject to the following conditions:
|
|
13
|
-
|
|
14
|
-
The above copyright notice and this permission notice shall be included in
|
|
15
|
-
all copies or substantial portions of the Software.
|
|
16
|
-
|
|
17
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
-
THE SOFTWARE.
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
# http-errors
|
|
2
|
-
|
|
3
|
-
[![NPM Version][npm-version-image]][npm-url]
|
|
4
|
-
[![NPM Downloads][npm-downloads-image]][node-url]
|
|
5
|
-
[![Node.js Version][node-image]][node-url]
|
|
6
|
-
[![Build Status][ci-image]][ci-url]
|
|
7
|
-
[![Test Coverage][coveralls-image]][coveralls-url]
|
|
8
|
-
|
|
9
|
-
Create HTTP errors for Express, Koa, Connect, etc. with ease.
|
|
10
|
-
|
|
11
|
-
## Install
|
|
12
|
-
|
|
13
|
-
This is a [Node.js](https://nodejs.org/en/) module available through the
|
|
14
|
-
[npm registry](https://www.npmjs.com/). Installation is done using the
|
|
15
|
-
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
|
16
|
-
|
|
17
|
-
```console
|
|
18
|
-
$ npm install http-errors
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Example
|
|
22
|
-
|
|
23
|
-
```js
|
|
24
|
-
var createError = require('http-errors')
|
|
25
|
-
var express = require('express')
|
|
26
|
-
var app = express()
|
|
27
|
-
|
|
28
|
-
app.use(function (req, res, next) {
|
|
29
|
-
if (!req.user) return next(createError(401, 'Please login to view this page.'))
|
|
30
|
-
next()
|
|
31
|
-
})
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## API
|
|
35
|
-
|
|
36
|
-
This is the current API, currently extracted from Koa and subject to change.
|
|
37
|
-
|
|
38
|
-
### Error Properties
|
|
39
|
-
|
|
40
|
-
- `expose` - can be used to signal if `message` should be sent to the client,
|
|
41
|
-
defaulting to `false` when `status` >= 500
|
|
42
|
-
- `headers` - can be an object of header names to values to be sent to the
|
|
43
|
-
client, defaulting to `undefined`. When defined, the key names should all
|
|
44
|
-
be lower-cased
|
|
45
|
-
- `message` - the traditional error message, which should be kept short and all
|
|
46
|
-
single line
|
|
47
|
-
- `status` - the status code of the error, mirroring `statusCode` for general
|
|
48
|
-
compatibility
|
|
49
|
-
- `statusCode` - the status code of the error, defaulting to `500`
|
|
50
|
-
|
|
51
|
-
### createError([status], [message], [properties])
|
|
52
|
-
|
|
53
|
-
Create a new error object with the given message `msg`.
|
|
54
|
-
The error object inherits from `createError.HttpError`.
|
|
55
|
-
|
|
56
|
-
```js
|
|
57
|
-
var err = createError(404, 'This video does not exist!')
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
- `status: 500` - the status code as a number
|
|
61
|
-
- `message` - the message of the error, defaulting to node's text for that status code.
|
|
62
|
-
- `properties` - custom properties to attach to the object
|
|
63
|
-
|
|
64
|
-
### createError([status], [error], [properties])
|
|
65
|
-
|
|
66
|
-
Extend the given `error` object with `createError.HttpError`
|
|
67
|
-
properties. This will not alter the inheritance of the given
|
|
68
|
-
`error` object, and the modified `error` object is the
|
|
69
|
-
return value.
|
|
70
|
-
|
|
71
|
-
<!-- eslint-disable no-redeclare -->
|
|
72
|
-
|
|
73
|
-
```js
|
|
74
|
-
fs.readFile('foo.txt', function (err, buf) {
|
|
75
|
-
if (err) {
|
|
76
|
-
if (err.code === 'ENOENT') {
|
|
77
|
-
var httpError = createError(404, err, { expose: false })
|
|
78
|
-
} else {
|
|
79
|
-
var httpError = createError(500, err)
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
- `status` - the status code as a number
|
|
86
|
-
- `error` - the error object to extend
|
|
87
|
-
- `properties` - custom properties to attach to the object
|
|
88
|
-
|
|
89
|
-
### createError.isHttpError(val)
|
|
90
|
-
|
|
91
|
-
Determine if the provided `val` is an `HttpError`. This will return `true`
|
|
92
|
-
if the error inherits from the `HttpError` constructor of this module or
|
|
93
|
-
matches the "duck type" for an error this module creates. All outputs from
|
|
94
|
-
the `createError` factory will return `true` for this function, including
|
|
95
|
-
if an non-`HttpError` was passed into the factory.
|
|
96
|
-
|
|
97
|
-
### new createError\[code || name\](\[msg]\))
|
|
98
|
-
|
|
99
|
-
Create a new error object with the given message `msg`.
|
|
100
|
-
The error object inherits from `createError.HttpError`.
|
|
101
|
-
|
|
102
|
-
```js
|
|
103
|
-
var err = new createError.NotFound()
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
- `code` - the status code as a number
|
|
107
|
-
- `name` - the name of the error as a "bumpy case", i.e. `NotFound` or `InternalServerError`.
|
|
108
|
-
|
|
109
|
-
#### List of all constructors
|
|
110
|
-
|
|
111
|
-
|Status Code|Constructor Name |
|
|
112
|
-
|-----------|-----------------------------|
|
|
113
|
-
|400 |BadRequest |
|
|
114
|
-
|401 |Unauthorized |
|
|
115
|
-
|402 |PaymentRequired |
|
|
116
|
-
|403 |Forbidden |
|
|
117
|
-
|404 |NotFound |
|
|
118
|
-
|405 |MethodNotAllowed |
|
|
119
|
-
|406 |NotAcceptable |
|
|
120
|
-
|407 |ProxyAuthenticationRequired |
|
|
121
|
-
|408 |RequestTimeout |
|
|
122
|
-
|409 |Conflict |
|
|
123
|
-
|410 |Gone |
|
|
124
|
-
|411 |LengthRequired |
|
|
125
|
-
|412 |PreconditionFailed |
|
|
126
|
-
|413 |PayloadTooLarge |
|
|
127
|
-
|414 |URITooLong |
|
|
128
|
-
|415 |UnsupportedMediaType |
|
|
129
|
-
|416 |RangeNotSatisfiable |
|
|
130
|
-
|417 |ExpectationFailed |
|
|
131
|
-
|418 |ImATeapot |
|
|
132
|
-
|421 |MisdirectedRequest |
|
|
133
|
-
|422 |UnprocessableEntity |
|
|
134
|
-
|423 |Locked |
|
|
135
|
-
|424 |FailedDependency |
|
|
136
|
-
|425 |TooEarly |
|
|
137
|
-
|426 |UpgradeRequired |
|
|
138
|
-
|428 |PreconditionRequired |
|
|
139
|
-
|429 |TooManyRequests |
|
|
140
|
-
|431 |RequestHeaderFieldsTooLarge |
|
|
141
|
-
|451 |UnavailableForLegalReasons |
|
|
142
|
-
|500 |InternalServerError |
|
|
143
|
-
|501 |NotImplemented |
|
|
144
|
-
|502 |BadGateway |
|
|
145
|
-
|503 |ServiceUnavailable |
|
|
146
|
-
|504 |GatewayTimeout |
|
|
147
|
-
|505 |HTTPVersionNotSupported |
|
|
148
|
-
|506 |VariantAlsoNegotiates |
|
|
149
|
-
|507 |InsufficientStorage |
|
|
150
|
-
|508 |LoopDetected |
|
|
151
|
-
|509 |BandwidthLimitExceeded |
|
|
152
|
-
|510 |NotExtended |
|
|
153
|
-
|511 |NetworkAuthenticationRequired|
|
|
154
|
-
|
|
155
|
-
## License
|
|
156
|
-
|
|
157
|
-
[MIT](LICENSE)
|
|
158
|
-
|
|
159
|
-
[ci-image]: https://badgen.net/github/checks/jshttp/http-errors/master?label=ci
|
|
160
|
-
[ci-url]: https://github.com/jshttp/http-errors/actions?query=workflow%3Aci
|
|
161
|
-
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/http-errors/master
|
|
162
|
-
[coveralls-url]: https://coveralls.io/r/jshttp/http-errors?branch=master
|
|
163
|
-
[node-image]: https://badgen.net/npm/node/http-errors
|
|
164
|
-
[node-url]: https://nodejs.org/en/download
|
|
165
|
-
[npm-downloads-image]: https://badgen.net/npm/dm/http-errors
|
|
166
|
-
[npm-url]: https://npmjs.org/package/http-errors
|
|
167
|
-
[npm-version-image]: https://badgen.net/npm/v/http-errors
|
|
168
|
-
[travis-image]: https://badgen.net/travis/jshttp/http-errors/master
|
|
169
|
-
[travis-url]: https://travis-ci.org/jshttp/http-errors
|