File tree 5 files changed +9
-7
lines changed
5 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 14
14
15
15
const isPromise = require ( 'is-promise' )
16
16
const Layer = require ( './lib/layer' )
17
- const methods = require ( 'methods ' )
17
+ const { METHODS } = require ( 'node:http ' )
18
18
const mixin = require ( 'utils-merge' )
19
19
const parseUrl = require ( 'parseurl' )
20
20
const Route = require ( './lib/route' )
@@ -26,6 +26,7 @@ const Route = require('./lib/route')
26
26
27
27
const slice = Array . prototype . slice
28
28
const flatten = Array . prototype . flat
29
+ const methods = METHODS . map ( ( method ) => method . toLowerCase ( ) )
29
30
30
31
/**
31
32
* Expose `Router`.
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ const { METHODS } = require('node:http')
22
22
23
23
const slice = Array . prototype . slice
24
24
const flatten = Array . prototype . flat
25
+ const methods = METHODS . map ( ( method ) => method . toLowerCase ( ) )
25
26
26
27
/* istanbul ignore next */
27
28
const defer = typeof setImmediate === 'function'
@@ -215,9 +216,6 @@ Route.prototype.all = function all (handler) {
215
216
return this
216
217
}
217
218
218
-
219
- const methods = METHODS . map ( ( method ) => method . toLowerCase ( ) )
220
-
221
219
methods . forEach ( function ( method ) {
222
220
Route . prototype [ method ] = function ( handler ) {
223
221
const callbacks = flatten . call ( slice . call ( arguments ) , Infinity )
Original file line number Diff line number Diff line change 1
1
const { it, describe } = require ( 'mocha' )
2
2
const Buffer = require ( 'safe-buffer' ) . Buffer
3
- const methods = require ( 'methods' )
4
3
const series = require ( 'run-series' )
5
4
const Router = require ( '..' )
6
5
const utils = require ( './support/utils' )
@@ -13,6 +12,7 @@ const shouldHaveBody = utils.shouldHaveBody
13
12
const shouldHitHandle = utils . shouldHitHandle
14
13
const shouldNotHaveBody = utils . shouldNotHaveBody
15
14
const shouldNotHitHandle = utils . shouldNotHitHandle
15
+ const methods = utils . methods
16
16
17
17
const describePromises = global . Promise ? describe : describe . skip
18
18
Original file line number Diff line number Diff line change 1
1
const { it, describe } = require ( 'mocha' )
2
2
const series = require ( 'run-series' )
3
3
const Buffer = require ( 'safe-buffer' ) . Buffer
4
- const methods = require ( 'methods' )
5
4
const Router = require ( '..' )
6
5
const utils = require ( './support/utils' )
7
6
@@ -14,6 +13,7 @@ const shouldHaveBody = utils.shouldHaveBody
14
13
const shouldHitHandle = utils . shouldHitHandle
15
14
const shouldNotHaveBody = utils . shouldNotHaveBody
16
15
const shouldNotHitHandle = utils . shouldNotHitHandle
16
+ const methods = utils . methods
17
17
18
18
const describePromises = global . Promise ? describe : describe . skip
19
19
Original file line number Diff line number Diff line change @@ -2,9 +2,11 @@ const assert = require('assert')
2
2
const Buffer = require ( 'safe-buffer' ) . Buffer
3
3
const finalhandler = require ( 'finalhandler' )
4
4
const http = require ( 'http' )
5
- const methods = require ( 'methods ' )
5
+ const { METHODS } = require ( 'node:http ' )
6
6
const request = require ( 'supertest' )
7
7
8
+ const methods = METHODS . map ( ( method ) => method . toLowerCase ( ) )
9
+
8
10
exports . assert = assert
9
11
exports . createHitHandle = createHitHandle
10
12
exports . createServer = createServer
@@ -14,6 +16,7 @@ exports.shouldHaveBody = shouldHaveBody
14
16
exports . shouldNotHaveBody = shouldNotHaveBody
15
17
exports . shouldHitHandle = shouldHitHandle
16
18
exports . shouldNotHitHandle = shouldNotHitHandle
19
+ exports . methods = methods
17
20
18
21
function createHitHandle ( num ) {
19
22
const name = 'x-fn-' + String ( num )
You can’t perform that action at this time.
0 commit comments