diff options
author | Ashton Kinslow <github@ashtonkinslow.com> | 2016-12-01 15:12:39 -0600 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2016-12-03 11:52:00 +0100 |
commit | c5ccc50d1f5d2ae451233aa4d6b327d318ed2825 (patch) | |
tree | 33e7aa815ad9be23142d32b86db53ed86fe51930 | |
parent | c0d11752d9c90d6c1c58f9cfd552b9c78f806cd0 (diff) | |
download | android-node-v8-c5ccc50d1f5d2ae451233aa4d6b327d318ed2825.tar.gz android-node-v8-c5ccc50d1f5d2ae451233aa4d6b327d318ed2825.tar.bz2 android-node-v8-c5ccc50d1f5d2ae451233aa4d6b327d318ed2825.zip |
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: 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>
-rw-r--r-- | test/parallel/test-http-request-invalid-method-error.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/parallel/test-http-request-invalid-method-error.js b/test/parallel/test-http-request-invalid-method-error.js new file mode 100644 index 0000000000..febb340eac --- /dev/null +++ b/test/parallel/test-http-request-invalid-method-error.js @@ -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); + } +); |