Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0cab6eb

Browse filesBrowse 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 <matteo.collina@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent f9386f2 commit 0cab6eb
Copy full SHA for 0cab6eb

File tree

Expand file treeCollapse file tree

1 file changed

+12
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-0
lines changed
Open diff view settings
Collapse file
+12Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.