From 0cab6eb6ca91f6e1215c8d580a934e2a51223aef Mon Sep 17 00:00:00 2001
From: Ashton Kinslow <github@ashtonkinslow.com>
Date: Thu, 1 Dec 2016 15:12:39 -0600
Subject: [PATCH] test: test for http.request() invalid method error
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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>
---
 .../test-http-request-invalid-method-error.js        | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 test/parallel/test-http-request-invalid-method-error.js

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 00000000000000..febb340eacd2a4
--- /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);
+  }
+);