http-status-code
Advanced tools
Comparing version 2.0.1 to 2.1.0
// Miscellanious Status Codes | ||
// https://tools.ietf.org/html/draft-tbray-http-legally-restricted-status-00 | ||
// https://tools.ietf.org/html/draft-kazuho-early-hints-status-code-00 | ||
{ | ||
// 1xx - Informational | ||
// This informational status code indicates the client that the server | ||
// is likely to send a final request with the headers included in the | ||
// informational response. | ||
"103": "Early Hints", | ||
// 4xx - User Error | ||
// This status code indicates that the server is subject to legal restrictions which prevent it | ||
// This status code indicates that the server is subject to legal restrictions which prevent it | ||
// servicing the request. Since such restrictions typically apply to all operators in a legal | ||
@@ -9,0 +17,0 @@ // jurisdiction, the server in question may or may not be an origin server. The restrictions typically |
'use strict'; | ||
const fs = require('fs'), | ||
const | ||
fs = require('fs'), | ||
Path = require('path'), | ||
@@ -10,3 +11,4 @@ strip = require('strip-json-comments'), | ||
'HTTP/2.0': ['H2', 'H2C', '2', '2.0', 'HTTP/2', 'HTTP/2.0'], | ||
WEBDAV: ['DAV', 'WEBDAV'] | ||
WEBDAV: ['DAV', 'WEBDAV'], | ||
misc: ['misc', 'miscellanious'] | ||
}; | ||
@@ -27,4 +29,4 @@ | ||
rfcList.forEach(function(rfc) { | ||
Object.keys(definitions[rfc]).forEach(function(status) { | ||
rfcList.forEach((rfc) => { | ||
Object.keys(definitions[rfc]).forEach((status) => { | ||
result[status] = definitions[rfc][status]; | ||
@@ -46,3 +48,3 @@ }); | ||
function _getProtocol(protocol) { | ||
return Object.keys(map).filter(function(key) { | ||
return Object.keys(map).filter((key) => { | ||
return map[key].indexOf(protocol) !== -1; | ||
@@ -97,2 +99,6 @@ })[0]; | ||
case 'misc': | ||
rfcList = ['misc']; | ||
break; | ||
default: | ||
@@ -123,3 +129,3 @@ rfcList = Object.keys(definitions); | ||
fs.readdirSync(path).forEach(filename => { | ||
fs.readdirSync(path).forEach((filename) => { | ||
let file = fs.readFileSync(Path.join(path, filename), {encoding: 'utf8'}); | ||
@@ -126,0 +132,0 @@ |
{ | ||
"name": "http-status-code", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Easy access to HTTP Status Codes", | ||
@@ -5,0 +5,0 @@ "main": "./lib", |
@@ -222,2 +222,3 @@ [](http://badge.fury.io/js/http-status-code) | ||
#### Status Codes | ||
- 103 Early Hints ([misc](https://tools.ietf.org/html/draft-kazuho-early-hints-status-code-00)) | ||
- 418: I'm A Teapot ([RFC2324](http://tools.ietf.org/html/rfc2324)) | ||
@@ -224,0 +225,0 @@ - 451: Unavailable For Legal Reasons ([misc](https://tools.ietf.org/html/draft-tbray-http-legally-restricted-status-00)) |
@@ -7,3 +7,3 @@ 'use strict'; | ||
HTTPStatusCode = require('../lib'), | ||
protocols = ['HTTP/1.0', 'HTTP/1.1', 'HTTP/2', 'WEBDAV'], | ||
protocols = ['HTTP/1.0', 'HTTP/1.1', 'HTTP/2', 'WEBDAV', 'misc'], | ||
definitions = HTTPStatusCode.getProtocolDefinitions(); | ||
@@ -10,0 +10,0 @@ |
53374
641
231