summaryrefslogtreecommitdiff
path: root/test/parallel/test-http-response-statuscode.js
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2017-02-07 12:47:11 -0500
committercjihrig <cjihrig@gmail.com>2017-02-09 12:38:06 -0500
commita4bb9fdb893c8f2c36a6b77862e29b2608e080c2 (patch)
tree3edd4030e6a2e43bffcca32057cc45d79bf08dec /test/parallel/test-http-response-statuscode.js
parentc239581e64668946cc4e95f126dc55912a2bd527 (diff)
downloadandroid-node-v8-a4bb9fdb893c8f2c36a6b77862e29b2608e080c2.tar.gz
android-node-v8-a4bb9fdb893c8f2c36a6b77862e29b2608e080c2.tar.bz2
android-node-v8-a4bb9fdb893c8f2c36a6b77862e29b2608e080c2.zip
http: include provided status code in range error
ServerResponse#writeHead() coerces the user provided status code to a number and then performs a range check. If the check fails, a range error is thrown. The coerced status code is included in the error message. This commit uses the user provided status code instead. PR-URL: https://github.com/nodejs/node/pull/11221 Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-http-response-statuscode.js')
-rw-r--r--test/parallel/test-http-response-statuscode.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/parallel/test-http-response-statuscode.js b/test/parallel/test-http-response-statuscode.js
index ed3676b03e..1b2d4d598e 100644
--- a/test/parallel/test-http-response-statuscode.js
+++ b/test/parallel/test-http-response-statuscode.js
@@ -20,17 +20,17 @@ const server = http.Server(common.mustCall(function(req, res) {
case 1:
assert.throws(common.mustCall(() => {
res.writeHead(Infinity);
- }), createErrorMessage(0));
+ }), createErrorMessage(Infinity));
break;
case 2:
assert.throws(common.mustCall(() => {
res.writeHead(NaN);
- }), createErrorMessage(0));
+ }), createErrorMessage(NaN));
break;
case 3:
assert.throws(common.mustCall(() => {
res.writeHead({});
- }), createErrorMessage(0));
+ }), createErrorMessage('\\[object Object\\]'));
break;
case 4:
assert.throws(common.mustCall(() => {
@@ -45,37 +45,37 @@ const server = http.Server(common.mustCall(function(req, res) {
case 6:
assert.throws(common.mustCall(() => {
res.writeHead('1000');
- }), createErrorMessage(1000));
+ }), createErrorMessage('1000'));
break;
case 7:
assert.throws(common.mustCall(() => {
res.writeHead(null);
- }), createErrorMessage(0));
+ }), createErrorMessage(null));
break;
case 8:
assert.throws(common.mustCall(() => {
res.writeHead(true);
- }), createErrorMessage(1));
+ }), createErrorMessage(true));
break;
case 9:
assert.throws(common.mustCall(() => {
res.writeHead([]);
- }), createErrorMessage(0));
+ }), createErrorMessage([]));
break;
case 10:
assert.throws(common.mustCall(() => {
res.writeHead('this is not valid');
- }), createErrorMessage(0));
+ }), createErrorMessage('this is not valid'));
break;
case 11:
assert.throws(common.mustCall(() => {
res.writeHead('404 this is not valid either');
- }), createErrorMessage(0));
+ }), createErrorMessage('404 this is not valid either'));
break;
case 12:
assert.throws(common.mustCall(() => {
res.writeHead();
- }), createErrorMessage(0));
+ }), createErrorMessage(undefined));
this.close();
break;
default: