I propose the same interface as pretty-cache-header, with a class for the cache control header that includes all of the available directives as properties. Optionally, allowing time strings in addition to numbers would be great, eg. "1hour" === 3600
This feature does request does not include ETag/If-None-Match/If-Modified-Since. Just the Cache-Control header
Example:
let headers = new Headers();
headers.cacheControl = "public, max-age=604800, s-maxage=3600"
console.log(headers.cacheControl.public) // true
console.log(headers.cacheControl.maxAge) // 604800
// Optionally use time strings where appropriate
headers.cacheControl.maxAge = "1hour"
console.log(headers.get('Cache-Control')) // "public, max-age=3600, s-maxage=3600"
I intend to start implementing this myself. Hopefully I can get a PR in the next few days. Just wanted to get it on your radar in case you don't love the implementation.
I propose the same interface as pretty-cache-header, with a class for the cache control header that includes all of the available directives as properties. Optionally, allowing time strings in addition to numbers would be great, eg.
"1hour" === 3600
This feature does request does not include ETag/If-None-Match/If-Modified-Since. Just the Cache-Control header
Example: