Skip to content

Commit

Permalink
test: cover all HTTP methods that parser supports
Browse files Browse the repository at this point in the history
Cover all request methods that Node's HTTP parser supports in
parallel/test-http-methods.

PR-URL: #14773
Refs: #14544
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
oantoro authored and MylesBorins committed Sep 20, 2017
1 parent d20b7bf commit 1aac05b
Showing 1 changed file with 40 additions and 7 deletions.
47 changes: 40 additions & 7 deletions test/parallel/test-http-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());

0 comments on commit 1aac05b

Please sign in to comment.