mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 00:30:06 +00:00

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: https://github.com/nodejs/node/pull/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>
13 lines
279 B
JavaScript
13 lines
279 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const http = require('http');
|
|
|
|
assert.throws(
|
|
() => { http.request({method: '\0'}); },
|
|
(error) => {
|
|
return (error instanceof TypeError) &&
|
|
/Method must be a valid HTTP token/.test(error);
|
|
}
|
|
);
|