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