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 <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
oantoro authored and addaleax committed Aug 14, 2017
1 parent ac1b81a commit 6d9f94f
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 @@ -23,11 +23,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 6d9f94f

Please sign in to comment.