Skip to content

Commit 0cab6eb

Browse files
ashtonianaddaleax
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: #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 f9386f2 commit 0cab6eb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
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)