@contrast/route-coverage 1.39.0 → 1.41.0
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/lib/install/fastify.js +6 -6
- package/lib/utils/methods.js +2 -2
- package/package.json +6 -6
package/lib/install/fastify.js
CHANGED
|
@@ -109,13 +109,13 @@ module.exports = function init(core) {
|
|
|
109
109
|
*/
|
|
110
110
|
[
|
|
111
111
|
{ version: '>=3 <4.1.0', routeObj: false },
|
|
112
|
-
{ version: '>=4.1.0 <
|
|
113
|
-
{ version: '>=4.4.0 <5', routeObj: true }
|
|
112
|
+
{ version: '>=4.1.0 <6', routeObj: true },
|
|
114
113
|
].forEach(({ version, routeObj }) => {
|
|
115
114
|
// See ../utils/methods
|
|
116
115
|
// Using .all shorthand uses all valid methods but those change after version 4.4.0
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
depHooks.resolve({ name: 'fastify', version, file: 'lib/route.js' }, (Route, metadata) => {
|
|
117
|
+
const fastifyMethods = getFastifyMethods(metadata.version);
|
|
118
|
+
|
|
119
119
|
patcher.patch(Route, 'buildRouting', {
|
|
120
120
|
name: 'fastify.Route.buildRouting',
|
|
121
121
|
patchType,
|
|
@@ -144,7 +144,7 @@ module.exports = function init(core) {
|
|
|
144
144
|
let handle = 'handler';
|
|
145
145
|
if (!handler && typeof options === 'function') handle = 'options';
|
|
146
146
|
|
|
147
|
-
discoverAndPatch(method, path, routeObj ? data.args[0] : data.args, handle,
|
|
147
|
+
discoverAndPatch(method, path, routeObj ? data.args[0] : data.args, handle, fastifyMethods, false);
|
|
148
148
|
}
|
|
149
149
|
});
|
|
150
150
|
|
|
@@ -161,7 +161,7 @@ module.exports = function init(core) {
|
|
|
161
161
|
|
|
162
162
|
const prefix = getPrefix(data.obj);
|
|
163
163
|
const path = prefix ? prefix + url : url;
|
|
164
|
-
discoverAndPatch(method, path, routeArgs, 'handler',
|
|
164
|
+
discoverAndPatch(method, path, routeArgs, 'handler', fastifyMethods, true);
|
|
165
165
|
}
|
|
166
166
|
});
|
|
167
167
|
}
|
package/lib/utils/methods.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
const semver = require('semver');
|
|
18
18
|
const { METHODS } = require('http');
|
|
19
19
|
|
|
20
|
-
function getFastifyMethods(
|
|
20
|
+
function getFastifyMethods(version) {
|
|
21
21
|
return [
|
|
22
22
|
'DELETE',
|
|
23
23
|
'GET',
|
|
@@ -26,7 +26,7 @@ function getFastifyMethods(range) {
|
|
|
26
26
|
'POST',
|
|
27
27
|
'PUT',
|
|
28
28
|
'OPTIONS',
|
|
29
|
-
...semver.
|
|
29
|
+
...semver.satisfies(version, '>=4.4.0 <5') ?
|
|
30
30
|
[
|
|
31
31
|
'PROPFIND',
|
|
32
32
|
'PROPPATCH',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/route-coverage",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.41.0",
|
|
4
4
|
"description": "Handles route discovery and observation",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@contrast/common": "1.32.0",
|
|
24
|
-
"@contrast/config": "1.
|
|
25
|
-
"@contrast/dep-hooks": "1.
|
|
24
|
+
"@contrast/config": "1.45.0",
|
|
25
|
+
"@contrast/dep-hooks": "1.19.0",
|
|
26
26
|
"@contrast/fn-inspect": "^4.3.0",
|
|
27
|
-
"@contrast/logger": "1.
|
|
28
|
-
"@contrast/patcher": "1.
|
|
29
|
-
"@contrast/scopes": "1.
|
|
27
|
+
"@contrast/logger": "1.23.0",
|
|
28
|
+
"@contrast/patcher": "1.22.0",
|
|
29
|
+
"@contrast/scopes": "1.20.0",
|
|
30
30
|
"semver": "^7.6.0",
|
|
31
31
|
"path-to-regexp": "^8.2.0"
|
|
32
32
|
}
|