1 |
3a515b92
|
cagy
|
/*!
|
2 |
|
|
* methods
|
3 |
|
|
* Copyright(c) 2013-2014 TJ Holowaychuk
|
4 |
|
|
* Copyright(c) 2015-2016 Douglas Christopher Wilson
|
5 |
|
|
* MIT Licensed
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
'use strict';
|
9 |
|
|
|
10 |
|
|
/**
|
11 |
|
|
* Module dependencies.
|
12 |
|
|
* @private
|
13 |
|
|
*/
|
14 |
|
|
|
15 |
|
|
var http = require('http');
|
16 |
|
|
|
17 |
|
|
/**
|
18 |
|
|
* Module exports.
|
19 |
|
|
* @public
|
20 |
|
|
*/
|
21 |
|
|
|
22 |
|
|
module.exports = getCurrentNodeMethods() || getBasicNodeMethods();
|
23 |
|
|
|
24 |
|
|
/**
|
25 |
|
|
* Get the current Node.js methods.
|
26 |
|
|
* @private
|
27 |
|
|
*/
|
28 |
|
|
|
29 |
|
|
function getCurrentNodeMethods() {
|
30 |
|
|
return http.METHODS && http.METHODS.map(function lowerCaseMethod(method) {
|
31 |
|
|
return method.toLowerCase();
|
32 |
|
|
});
|
33 |
|
|
}
|
34 |
|
|
|
35 |
|
|
/**
|
36 |
|
|
* Get the "basic" Node.js methods, a snapshot from Node.js 0.10.
|
37 |
|
|
* @private
|
38 |
|
|
*/
|
39 |
|
|
|
40 |
|
|
function getBasicNodeMethods() {
|
41 |
|
|
return [
|
42 |
|
|
'get',
|
43 |
|
|
'post',
|
44 |
|
|
'put',
|
45 |
|
|
'head',
|
46 |
|
|
'delete',
|
47 |
|
|
'options',
|
48 |
|
|
'trace',
|
49 |
|
|
'copy',
|
50 |
|
|
'lock',
|
51 |
|
|
'mkcol',
|
52 |
|
|
'move',
|
53 |
|
|
'purge',
|
54 |
|
|
'propfind',
|
55 |
|
|
'proppatch',
|
56 |
|
|
'unlock',
|
57 |
|
|
'report',
|
58 |
|
|
'mkactivity',
|
59 |
|
|
'checkout',
|
60 |
|
|
'merge',
|
61 |
|
|
'm-search',
|
62 |
|
|
'notify',
|
63 |
|
|
'subscribe',
|
64 |
|
|
'unsubscribe',
|
65 |
|
|
'patch',
|
66 |
|
|
'search',
|
67 |
|
|
'connect'
|
68 |
|
|
];
|
69 |
|
|
}
|