Phong Duong

🔎Search

Get all supported HTTP methods with Nodejs

09-12-2020 | #nodejs

To get all HTTP methods that are supported by NodeJS, you can retrieve METHODS property of http module. It will return a sorted array of all methods.

console.log(require("http").METHODS)
/*
[
  'ACL',         'BIND',       'CHECKOUT',
  'CONNECT',     'COPY',       'DELETE',
  'GET',         'HEAD',       'LINK',
  'LOCK',        'M-SEARCH',   'MERGE',
  'MKACTIVITY',  'MKCALENDAR', 'MKCOL',
  'MOVE',        'NOTIFY',     'OPTIONS',
  'PATCH',       'POST',       'PROPFIND',
  'PROPPATCH',   'PURGE',      'PUT',
  'REBIND',      'REPORT',     'SEARCH',
  'SOURCE',      'SUBSCRIBE',  'TRACE',
  'UNBIND',      'UNLINK',     'UNLOCK',
  'UNSUBSCRIBE'
]
*/

Share: TwitterFacebookLinkedInHacker News