diff --git a/.eslintrc.json b/.eslintrc.json index defb3a1..54bb626 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,6 +3,5 @@ "node": true, "es6": true, "mocha": true - }, - "extends": ["plugin:prettier/recommended"] + } } diff --git a/.huskyrc.json b/.huskyrc.json deleted file mode 100644 index 5090235..0000000 --- a/.huskyrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "hooks": { - "pre-commit": "lint-staged" - } -} diff --git a/.lintstagedrc.json b/.lintstagedrc.json deleted file mode 100644 index abf245e..0000000 --- a/.lintstagedrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "*.{js,json,md,yml,yaml}": ["prettier-eslint --write", "git add"] -} diff --git a/index.js b/index.js index 4f6c2f3..31fba48 100644 --- a/index.js +++ b/index.js @@ -7,6 +7,7 @@ const statusCodeCacheableByDefault = new Set([ 206, 300, 301, + 308, 404, 405, 410, @@ -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; diff --git a/package.json b/package.json index 897798d..defbb04 100644 --- a/package.json +++ b/package.json @@ -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", @@ -13,12 +13,6 @@ "author": "Kornel LesiƄski (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" } }