Skip to content

Commit 1aac05b

Browse files
oantoroMylesBorins
authored andcommitted
test: cover all HTTP methods that parser supports
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]>
1 parent d20b7bf commit 1aac05b

File tree

1 file changed

+40
-7
lines changed

1 file changed

+40
-7
lines changed

test/parallel/test-http-methods.js

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,44 @@
22
require('../common');
33
const assert = require('assert');
44
const http = require('http');
5-
const util = require('util');
65

7-
assert(Array.isArray(http.METHODS));
8-
assert(http.METHODS.length > 0);
9-
assert(http.METHODS.includes('GET'));
10-
assert(http.METHODS.includes('HEAD'));
11-
assert(http.METHODS.includes('POST'));
12-
assert.deepStrictEqual(util._extend([], http.METHODS), http.METHODS.sort());
6+
// This test ensures all http methods from HTTP parser are exposed
7+
// to http library
8+
9+
const methods = [
10+
'DELETE',
11+
'GET',
12+
'HEAD',
13+
'POST',
14+
'PUT',
15+
'CONNECT',
16+
'OPTIONS',
17+
'TRACE',
18+
'COPY',
19+
'LOCK',
20+
'MKCOL',
21+
'MOVE',
22+
'PROPFIND',
23+
'PROPPATCH',
24+
'SEARCH',
25+
'UNLOCK',
26+
'BIND',
27+
'REBIND',
28+
'UNBIND',
29+
'ACL',
30+
'REPORT',
31+
'MKACTIVITY',
32+
'CHECKOUT',
33+
'MERGE',
34+
'M-SEARCH',
35+
'NOTIFY',
36+
'SUBSCRIBE',
37+
'UNSUBSCRIBE',
38+
'PATCH',
39+
'PURGE',
40+
'MKCALENDAR',
41+
'LINK',
42+
'UNLINK'
43+
];
44+
45+
assert.deepStrictEqual(http.METHODS, methods.sort());

0 commit comments

Comments
 (0)