http-headers-js
Advanced tools
+26
-7
@@ -1,2 +0,2 @@ | ||
| let RespCodeIs = { | ||
| var RespCodeIs = { | ||
| Info: function (code) { | ||
@@ -19,3 +19,21 @@ return code > 99 && code < 200; | ||
| let ResponseCodes = { | ||
| var CacheControls = { | ||
| "IMMUTABLE": "immutable", | ||
| "MAX_AGE": "max-age", | ||
| "MAX_STALE": "max-stale", | ||
| "MIN_FRESH": "min-fresh", | ||
| "MUST_REVALIDATE": "must-revalidate", | ||
| "NO_CACHE": "no-cache", | ||
| "NO_STORE": "no-store", | ||
| "NO_TRANSFORM": "no-transform", | ||
| "ONLY_IF_CACHED": "only-if-cached", | ||
| "PRIVATE": "private", | ||
| "PROXY_REVALIDATE": "proxy-revalidate", | ||
| "PUBLIC": "public", | ||
| "S_MAXAGE": "s-maxage", | ||
| "STALE_IF_ERROR": "stale-if-error", | ||
| "STALE_WHILE_REVALIDATE": "stale-while-revalidate" | ||
| }; | ||
| var ResponseCodes = { | ||
@@ -101,3 +119,3 @@ "CONTINUE": 100, | ||
| let Methods = { | ||
| var Methods = { | ||
| "CONNECT": "CONNECT", | ||
@@ -122,3 +140,3 @@ "COPY": "COPY", | ||
| let Headers = { | ||
| var Headers = { | ||
| "A_IM": "A-IM", | ||
@@ -259,3 +277,3 @@ "ACCEPT": "Accept", | ||
| let ContentEncodings = { | ||
| var ContentEncodings = { | ||
| "AES128GCM": "aes128gcm", | ||
@@ -274,3 +292,3 @@ "BR": "br", | ||
| let TrackingStatuses = { | ||
| var TrackingStatuses = { | ||
| "UNDER_CONSTRUCTION": "!", | ||
@@ -287,3 +305,3 @@ "DYNAMIC": "?", | ||
| let MimeTypes = { | ||
| var MimeTypes = { | ||
| "Application": { | ||
@@ -446,2 +464,3 @@ "ATOM_XML": "application/atom+xml", | ||
| module.exports.RespCodeIs = RespCodeIs; | ||
| module.exports.CacheControls = CacheControls; | ||
@@ -448,0 +467,0 @@ |
+4
-3
| { | ||
| "name": "http-headers-js", | ||
| "version": "1.0.7", | ||
| "description": "Standard and common non-standard HTTP headers and MIME-types", | ||
| "version": "1.0.8", | ||
| "description": "Http constants for mime-types, headers, tracking-statuses, methods, content-encodings, response codes and cache-control instructions", | ||
| "main": "index.js", | ||
@@ -21,3 +21,4 @@ "scripts": { | ||
| "response code", | ||
| "response status" | ||
| "response status", | ||
| "cache-control" | ||
| ], | ||
@@ -24,0 +25,0 @@ "author": "Stepan Sypachev <sypachev_s_s@mail.ru>", |
+10
-2
| # Standard and common HTTP headers and Mime types | ||
| > current version 1.0.7 | ||
| > Current version 1.0.8 | ||
| Provides standard and common non-standard http headers, mime-types, methods, content codings, response statuses and tracking statuses. | ||
| Provides standard and common non-standard http headers, mime-types, methods, content codings, response statuses, cache-control instructions and tracking statuses. | ||
@@ -17,2 +17,4 @@ All headers are capitalized, hence `Access-Control-Request-Method` | ||
| All Cache-Control instructions are lowercase, hence `min-fresh` | ||
| Key names constructed from uppercase values, `-`, `+` and `.` substituted with `_`, hence | ||
@@ -26,2 +28,3 @@ | ||
| ResponseCodes.I_AM_A_TEAPOT //418 | ||
| CacheControls.MAX_AGE //max-age | ||
@@ -43,2 +46,3 @@ ## Usage | ||
| ResponseCodes, | ||
| CacheControls, | ||
| RespCodeIs | ||
@@ -52,2 +56,3 @@ } = require('http-headers-js'); | ||
| - ResponseCodes - response codes | ||
| - CacheControls - Cache-Control instructions | ||
| - MimeTypes - yes, mime types, fair and square | ||
@@ -139,2 +144,5 @@ - RespCodeIs - set of functions to get type of response code | ||
| ## What's new | ||
| ### 1.0.8 | ||
| - Added `CacheControls` | ||
| - Support older engines | ||
| ### 1.0.7 | ||
@@ -141,0 +149,0 @@ - Added `RespCodeIs` |
+7
-1
@@ -20,2 +20,8 @@ let { Headers } = require('http-headers-js'); | ||
| console.log(ResponseCodes.NOT_FOUND); | ||
| console.log(ResponseCodes.NOT_FOUND); | ||
| let { RespCodeIs } = require('http-headers-js'); | ||
| console.log(RespCodeIs.ServerErr(500)); | ||
| console.log(RespCodeIs.ServerErr(ResponseCodes.INTERNAL_SERVER_ERROR)); | ||
| console.log(RespCodeIs.ClientErr(ResponseCodes.USE_PROXY)); |
@@ -12,4 +12,4 @@ { | ||
| "dependencies": { | ||
| "http-headers-js": "^1.0.6" | ||
| "http-headers-js": "^1.0.7" | ||
| } | ||
| } |
+13
-1
@@ -9,3 +9,4 @@ let chai = require('chai'), | ||
| ResponseCodes, | ||
| RespCodeIs | ||
| RespCodeIs, | ||
| CacheControls | ||
| } = require('../index.js'); | ||
@@ -142,2 +143,12 @@ | ||
| describe("Test Cache", () => { | ||
| it ("should test key names", () => { | ||
| testKeys(CacheControls); | ||
| }); | ||
| it ("should access some", () => { | ||
| chai.expect(CacheControls.MAX_AGE).to.equal("max-age"); | ||
| chai.expect(CacheControls.NO_TRANSFORM).to.equal("no-transform"); | ||
| chai.expect(CacheControls.PROXY_REVALIDATE).to.equal("proxy-revalidate"); | ||
| }); | ||
| }); | ||
@@ -167,1 +178,2 @@ | ||
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
28786
5.8%594
5.88%186
4.49%6
20%