cache-control-parser
Advanced tools
+1
-1
| { | ||
| "name": "cache-control-parser", | ||
| "version": "2.0.2", | ||
| "version": "2.0.3", | ||
| "description": "A humble cache-control parser", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/etienne-martin/cache-control-parser", |
+20
-2
@@ -82,3 +82,3 @@ # cache-control-parser | ||
| ```json | ||
| ``` | ||
| ttl: 0 | ||
@@ -107,2 +107,20 @@ ``` | ||
| **Example** - Next.js API route response header: | ||
| ```typescript | ||
| import { stringify } from "cache-control-parser"; | ||
| import type { NextApiRequest, NextApiResponse } from "next"; | ||
| export default (req: NextApiRequest, res: NextApiResponse) => { | ||
| res.setHeader( | ||
| "Cache-Control", | ||
| stringify({ | ||
| "max-age": 300, | ||
| }) | ||
| ); | ||
| res.send("Hello world"); | ||
| }; | ||
| ``` | ||
| **Supported cache-control directives:** | ||
@@ -132,3 +150,3 @@ | ||
| ```typescript | ||
| import { CacheControl } from "cache-control-parser"; | ||
| import type { CacheControl } from "cache-control-parser"; | ||
| ``` | ||
@@ -135,0 +153,0 @@ |
11234
3.36%186
10.71%