Skip to content

Commit d8db1a7

Browse files
ashtonianJonathan Darling
authored andcommitted
test: test for http.request() invalid method error
Adds a test for when an invalid http method is passed into http.request() to verify an error is thrown, that the error is the correct type, and the error message is correct. PR-URL: nodejs#10080 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 1ce434a commit d8db1a7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict';
2+
require('../common');
3+
const assert = require('assert');
4+
const http = require('http');
5+
6+
assert.throws(
7+
() => { http.request({method: '\0'}); },
8+
(error) => {
9+
return (error instanceof TypeError) &&
10+
/Method must be a valid HTTP token/.test(error);
11+
}
12+
);

0 commit comments

Comments
 (0)