test: cover all HTTP methods that parser supports · nodejs/node@1aac05b

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