Showing with 7 additions and 21 deletions.
  1. +1 −2 .eslintrc.json
  2. +0 −5 .huskyrc.json
  3. +0 −3 .lintstagedrc.json
  4. +4 −3 index.js
  5. +2 −8 package.json
3 changes: 1 addition & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
"node": true,
"es6": true,
"mocha": true
},
"extends": ["plugin:prettier/recommended"]
}
}
5 changes: 0 additions & 5 deletions .huskyrc.json

This file was deleted.

3 changes: 0 additions & 3 deletions .lintstagedrc.json

This file was deleted.

7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const statusCodeCacheableByDefault = new Set([
206,
300,
301,
308,
404,
405,
410,
Expand Down Expand Up @@ -79,10 +80,10 @@ function parseCacheControl(header) {

// TODO: When there is more than one value present for a given directive (e.g., two Expires header fields, multiple Cache-Control: max-age directives),
// the directive's value is considered invalid. Caches are encouraged to consider responses that have invalid freshness information to be stale
const parts = header.trim().split(/\s*,\s*/); // TODO: lame parsing
const parts = header.trim().split(/,/);
for (const part of parts) {
const [k, v] = part.split(/\s*=\s*/, 2);
cc[k] = v === undefined ? true : v.replace(/^"|"$/g, ''); // TODO: lame unquoting
const [k, v] = part.split(/=/, 2);
cc[k.trim()] = v === undefined ? true : v.trim().replace(/^"|"$/g, '');
}

return cc;
Expand Down
10 changes: 2 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "http-cache-semantics",
"version": "4.1.0",
"version": "4.1.1",
"description": "Parses Cache-Control and other headers. Helps building correct HTTP caches and proxies",
"repository": "https://github.com/kornelski/http-cache-semantics.git",
"main": "index.js",
Expand All @@ -13,12 +13,6 @@
"author": "Kornel Lesiński <kornel@geekhood.net> (https://kornel.ski/)",
"license": "BSD-2-Clause",
"devDependencies": {
"eslint": "^5.13.0",
"eslint-plugin-prettier": "^3.0.1",
"husky": "^0.14.3",
"lint-staged": "^8.1.3",
"mocha": "^5.1.0",
"prettier": "^1.14.3",
"prettier-eslint-cli": "^4.7.1"
"mocha": "^10.0"
}
}