From a9e260aa682b4a0d26a5ff5d4e3e763e0eae6941 Mon Sep 17 00:00:00 2001 From: Max Barinov Date: Mon, 21 Dec 2015 16:00:16 +0300 Subject: [PATCH 1/2] http: 451 status code "Unavailable For Legal Reasons" This http code allows us to provide a fair reason when we can't return some data to the client by legal issues. IETF https://datatracker.ietf.org/doc/draft-ietf-httpbis-legally-restricted-status/ Fixes: #4376 --- lib/_http_server.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/_http_server.js b/lib/_http_server.js index e2221b759bd0c4..f524790fb2b13a 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -65,6 +65,7 @@ const STATUS_CODES = exports.STATUS_CODES = { 428 : 'Precondition Required', // RFC 6585 429 : 'Too Many Requests', // RFC 6585 431 : 'Request Header Fields Too Large',// RFC 6585 + 451 : 'Unavailable For Legal Reasons', 500 : 'Internal Server Error', 501 : 'Not Implemented', 502 : 'Bad Gateway', From 64aa56ba52203dea8e390b9d4a849e5a2fcbed0c Mon Sep 17 00:00:00 2001 From: Max Barinov Date: Tue, 22 Dec 2015 00:05:58 +0300 Subject: [PATCH 2/2] http: tests for 451 status code IETF https://datatracker.ietf.org/doc/draft-ietf-httpbis-legally-restricted-status/ Fixes: #4376 --- test/parallel/test-http-status-code.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-http-status-code.js b/test/parallel/test-http-status-code.js index 19c36b0b2fd27f..5fedb529f82fcc 100644 --- a/test/parallel/test-http-status-code.js +++ b/test/parallel/test-http-status-code.js @@ -7,7 +7,7 @@ var http = require('http'); // ServerResponse.prototype.statusCode var testsComplete = 0; -var tests = [200, 202, 300, 404, 500]; +var tests = [200, 202, 300, 404, 451, 500]; var testIdx = 0; var s = http.createServer(function(req, res) { @@ -42,6 +42,6 @@ function nextTest() { process.on('exit', function() { - assert.equal(4, testsComplete); + assert.equal(5, testsComplete); });