Skip to content

Commit 1268737

Browse files
oantoroaqrln
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 170ff0e commit 1268737

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
@@ -23,11 +23,44 @@
2323
require('../common');
2424
const assert = require('assert');
2525
const http = require('http');
26-
const util = require('util');
2726

28-
assert(Array.isArray(http.METHODS));
29-
assert(http.METHODS.length > 0);
30-
assert(http.METHODS.includes('GET'));
31-
assert(http.METHODS.includes('HEAD'));
32-
assert(http.METHODS.includes('POST'));
33-
assert.deepStrictEqual(util._extend([], http.METHODS), http.METHODS.sort());
27+
// This test ensures all http methods from HTTP parser are exposed
28+
// to http library
29+
30+
const methods = [
31+
'DELETE',
32+
'GET',
33+
'HEAD',
34+
'POST',
35+
'PUT',
36+
'CONNECT',
37+
'OPTIONS',
38+
'TRACE',
39+
'COPY',
40+
'LOCK',
41+
'MKCOL',
42+
'MOVE',
43+
'PROPFIND',
44+
'PROPPATCH',
45+
'SEARCH',
46+
'UNLOCK',
47+
'BIND',
48+
'REBIND',
49+
'UNBIND',
50+
'ACL',
51+
'REPORT',
52+
'MKACTIVITY',
53+
'CHECKOUT',
54+
'MERGE',
55+
'M-SEARCH',
56+
'NOTIFY',
57+
'SUBSCRIBE',
58+
'UNSUBSCRIBE',
59+
'PATCH',
60+
'PURGE',
61+
'MKCALENDAR',
62+
'LINK',
63+
'UNLINK'
64+
];
65+
66+
assert.deepStrictEqual(http.METHODS, methods.sort());

0 commit comments

Comments
 (0)