Browse Source

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: https://github.com/nodejs/node/pull/14773
Refs: https://github.com/nodejs/node/issues/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>
v6
Oky Antoro 7 years ago
committed by Alexey Orlenko
parent
commit
1268737e71
No known key found for this signature in database GPG Key ID: 81255941FDDB24ED
  1. 47
      test/parallel/test-http-methods.js

47
test/parallel/test-http-methods.js

@ -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());

Loading…
Cancel
Save