mirror of https://github.com/lukechilds/node.git
Browse Source
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>v6
Ashton Kinslow
8 years ago
committed by
Michaël Zasso
1 changed files with 12 additions and 0 deletions
@ -0,0 +1,12 @@ |
|||
'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); |
|||
} |
|||
); |
Loading…
Reference in new issue