From 1aac05b087400f707ab6799d6d53fb373b1ede70 Mon Sep 17 00:00:00 2001 From: Oky Antoro Date: Fri, 11 Aug 2017 22:30:03 +0700 Subject: [PATCH] test: cover all HTTP methods that parser supports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cover all request methods that Node's HTTP parser supports in parallel/test-http-methods. PR-URL: https://github.com/nodejs/node/pull/14773 Refs: https://github.com/nodejs/node/issues/14544 Reviewed-By: Alexey Orlenko Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-http-methods.js | 47 +++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-http-methods.js b/test/parallel/test-http-methods.js index fb49add6a2ad24..a0105d908265df 100644 --- a/test/parallel/test-http-methods.js +++ b/test/parallel/test-http-methods.js @@ -2,11 +2,44 @@ require('../common'); const assert = require('assert'); const http = require('http'); -const util = require('util'); -assert(Array.isArray(http.METHODS)); -assert(http.METHODS.length > 0); -assert(http.METHODS.includes('GET')); -assert(http.METHODS.includes('HEAD')); -assert(http.METHODS.includes('POST')); -assert.deepStrictEqual(util._extend([], http.METHODS), http.METHODS.sort()); +// This test ensures all http methods from HTTP parser are exposed +// to http library + +const methods = [ + 'DELETE', + 'GET', + 'HEAD', + 'POST', + 'PUT', + 'CONNECT', + 'OPTIONS', + 'TRACE', + 'COPY', + 'LOCK', + 'MKCOL', + 'MOVE', + 'PROPFIND', + 'PROPPATCH', + 'SEARCH', + 'UNLOCK', + 'BIND', + 'REBIND', + 'UNBIND', + 'ACL', + 'REPORT', + 'MKACTIVITY', + 'CHECKOUT', + 'MERGE', + 'M-SEARCH', + 'NOTIFY', + 'SUBSCRIBE', + 'UNSUBSCRIBE', + 'PATCH', + 'PURGE', + 'MKCALENDAR', + 'LINK', + 'UNLINK' +]; + +assert.deepStrictEqual(http.METHODS, methods.sort());