{"_id":"http-vary","_rev":"5-14f6f1a7610717bf45025067408bfc7f","name":"http-vary","dist-tags":{"latest":"1.0.3"},"versions":{"0.0.1":{"name":"http-vary","version":"0.0.1","keywords":["vary","http","header","headers","cache","caching","http-cache","vary-header","rfc9110","rfc9111","cache-key","parser"],"author":{"name":"Arthur Fiorette","email":"npm@arthur.place"},"license":"MIT","_id":"http-vary@0.0.1","maintainers":[{"name":"hazork","email":"arthur.fiorette@gmail.com"}],"homepage":"https://tinylibs.js.org/packages/http-vary","bugs":{"url":"https://github.com/arthurfiorette/tinylibs/issues"},"dist":{"shasum":"a0fc7ce1bf8be99aa86fc02be5bb9154a3b3d2c1","tarball":"https://registry.npmjs.org/http-vary/-/http-vary-0.0.1.tgz","fileCount":22,"integrity":"sha512-rPfHOgQVhWzLEi0gvdQ0rHmSNCv5vtGQATuO0ZQk84AcvxL8dSUjJbTCVvz/VZzrH0vzdx/t835+qlH9ZQSuuQ==","signatures":[{"sig":"MEUCID4RyLhhRsx38Z1bVrVt+BKHfCvkuqyfvxN5mdapx1JhAiEAwDJTvRVanaMvRVOf8aIVWw88gLHtViKp4Y8tgYGO/m0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":50268},"main":"dist/index.js","types":"dist/index.d.ts","unpkg":"dist/index.umd.js","module":"dist/index.mjs","source":"src/index.ts","gitHead":"80c060d1a6497496e7f517e5d21dffc6c31b2e2b","scripts":{"test":"jest --coverage","build":"microbundle --tsconfig tsconfig.build.json"},"_npmUser":{"name":"hazork","email":"arthur.fiorette@gmail.com"},"umd:main":"dist/index.umd.js","repository":{"url":"git+https://github.com/arthurfiorette/tinylibs.git","type":"git","directory":"packages/http-vary"},"_npmVersion":"11.6.1","description":"A minimal parser and utility for the HTTP Vary header.","directories":{},"sideEffects":false,"_nodeVersion":"24.10.0","_hasShrinkwrap":false,"devDependencies":{"microbundle":"catalog:bundle"},"_npmOperationalInternal":{"tmp":"tmp/http-vary_0.0.1_1766801187495_0.24070461108052887","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"http-vary","version":"1.0.0","keywords":["vary","http","header","headers","cache","caching","http-cache","vary-header","rfc9110","rfc9111","cache-key","parser"],"author":{"name":"Arthur Fiorette","email":"npm@arthur.place"},"license":"MIT","_id":"http-vary@1.0.0","maintainers":[{"name":"hazork","email":"arthur.fiorette@gmail.com"}],"homepage":"https://tinylibs.js.org/packages/http-vary","bugs":{"url":"https://github.com/arthurfiorette/tinylibs/issues"},"dist":{"shasum":"173ccb8a4045c829ebc1b88b8d3f64c37d7380c4","tarball":"https://registry.npmjs.org/http-vary/-/http-vary-1.0.0.tgz","fileCount":23,"integrity":"sha512-VhQZfb0ydzE0TXP1a09pkrUxMHGd7U18RR0xDXAvajaG0GpaGDf7ves+QZvr+oMLFjhSYpVuxmKxwbS0AFZ+ug==","signatures":[{"sig":"MEUCIHKiz+oxxfXVGc3LPKSu1EiduDwQMGNsnxQzpGdnhtc7AiEA0hM+q3z1ytcFob8wFAsWlZQ0ovt4BHi0VeAaf3D3vbw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/http-vary@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":51342},"main":"dist/index.js","_from":"file:http-vary-1.0.0.tgz","types":"dist/index.d.ts","unpkg":"dist/index.umd.js","module":"dist/index.mjs","source":"src/index.ts","scripts":{"test":"jest --coverage","build":"microbundle --tsconfig tsconfig.build.json"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d892ed95-daac-4c1e-a59a-276b0cb5cca7"}},"umd:main":"dist/index.umd.js","_resolved":"/tmp/033ad1b22e5fe4f95a7de299aa9e9023/http-vary-1.0.0.tgz","_integrity":"sha512-VhQZfb0ydzE0TXP1a09pkrUxMHGd7U18RR0xDXAvajaG0GpaGDf7ves+QZvr+oMLFjhSYpVuxmKxwbS0AFZ+ug==","repository":{"url":"git+https://github.com/arthurfiorette/tinylibs.git","type":"git","directory":"packages/http-vary"},"_npmVersion":"11.6.2","description":"A minimal parser and utility for the HTTP Vary header.","directories":{},"sideEffects":false,"_nodeVersion":"24.12.0","_hasShrinkwrap":false,"devDependencies":{"microbundle":"^0.15.1"},"_npmOperationalInternal":{"tmp":"tmp/http-vary_1.0.0_1766801285387_0.47796158749965767","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"http-vary","version":"1.0.1","keywords":["vary","http","header","headers","cache","caching","http-cache","vary-header","rfc9110","rfc9111","cache-key","parser"],"author":{"name":"Arthur Fiorette","email":"npm@arthur.place"},"license":"MIT","_id":"http-vary@1.0.1","maintainers":[{"name":"hazork","email":"arthur.fiorette@gmail.com"}],"homepage":"https://tinylibs.js.org/packages/http-vary","bugs":{"url":"https://github.com/arthurfiorette/tinylibs/issues"},"dist":{"shasum":"2997674dd7619133468334eb824f221f58ffe9b3","tarball":"https://registry.npmjs.org/http-vary/-/http-vary-1.0.1.tgz","fileCount":23,"integrity":"sha512-Bso8Ekurg9lh2k0Bvzhhp53ywM/PYo1iKRajHP4ss/r5HjDFLsYz1vmfdjol574xyEvCSJyCrA5DURHNl7V5XQ==","signatures":[{"sig":"MEYCIQDTn8nTTwYRWFLXi6jVbuopZ2stYT+S6j+U+uFrIV8KogIhANcxcuIcPZl4d+8lf6KBH5XKbS+nyaccTIAW9kyv6gss","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/http-vary@1.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":51412},"main":"dist/index.js","_from":"file:http-vary-1.0.1.tgz","types":"dist/index.d.ts","unpkg":"dist/index.umd.js","module":"dist/index.mjs","source":"src/index.ts","scripts":{"test":"jest --coverage","build":"microbundle --tsconfig tsconfig.build.json"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d892ed95-daac-4c1e-a59a-276b0cb5cca7"}},"umd:main":"dist/index.umd.js","_resolved":"/tmp/6902d00b9245c21dceb43d6f46cf0af7/http-vary-1.0.1.tgz","_integrity":"sha512-Bso8Ekurg9lh2k0Bvzhhp53ywM/PYo1iKRajHP4ss/r5HjDFLsYz1vmfdjol574xyEvCSJyCrA5DURHNl7V5XQ==","repository":{"url":"git+https://github.com/arthurfiorette/tinylibs.git","type":"git","directory":"packages/http-vary"},"_npmVersion":"11.6.2","description":"A minimal parser and utility for the HTTP Vary header.","directories":{},"sideEffects":false,"_nodeVersion":"24.12.0","_hasShrinkwrap":false,"devDependencies":{"microbundle":"^0.15.1"},"_npmOperationalInternal":{"tmp":"tmp/http-vary_1.0.1_1766801852881_0.4709956713952248","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"http-vary","version":"1.0.2","keywords":["vary","http","header","headers","cache","caching","http-cache","vary-header","rfc9110","rfc9111","cache-key","parser"],"author":{"name":"Arthur Fiorette","email":"npm@arthur.place"},"license":"MIT","_id":"http-vary@1.0.2","maintainers":[{"name":"hazork","email":"arthur.fiorette@gmail.com"}],"homepage":"https://tinylibs.js.org/packages/http-vary","bugs":{"url":"https://github.com/arthurfiorette/tinylibs/issues"},"dist":{"shasum":"307af4e547ea653e3a51067aca1c4d162e803fe9","tarball":"https://registry.npmjs.org/http-vary/-/http-vary-1.0.2.tgz","fileCount":23,"integrity":"sha512-SD5IylVRAYTvJbzW6jCu8UqQBc7JDjla3kTWFVNk3rKI200GEIAmdroGmjNG5Do261YlFozIPgY0e3pWz2S9iw==","signatures":[{"sig":"MEUCIBYjYVEOvbq2e3P9OGOZUMdXBETGKVd38vTTL9RPebCMAiEAp92qfhz/Ye3SGZpgLNiu5kh3eMvcL5lWfHGOuytFm2A=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/http-vary@1.0.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":51686},"main":"dist/index.js","_from":"file:http-vary-1.0.2.tgz","types":"dist/index.d.ts","unpkg":"dist/index.umd.js","module":"dist/index.mjs","source":"src/index.ts","scripts":{"test":"jest --coverage","build":"microbundle --tsconfig tsconfig.build.json"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d892ed95-daac-4c1e-a59a-276b0cb5cca7"}},"umd:main":"dist/index.umd.js","_resolved":"/tmp/4073a9bcb427a360dfda54350e8b4dbc/http-vary-1.0.2.tgz","_integrity":"sha512-SD5IylVRAYTvJbzW6jCu8UqQBc7JDjla3kTWFVNk3rKI200GEIAmdroGmjNG5Do261YlFozIPgY0e3pWz2S9iw==","repository":{"url":"git+https://github.com/arthurfiorette/tinylibs.git","type":"git","directory":"packages/http-vary"},"_npmVersion":"11.6.2","description":"A minimal parser and utility for the HTTP Vary header.","directories":{},"sideEffects":false,"_nodeVersion":"24.12.0","_hasShrinkwrap":false,"devDependencies":{"microbundle":"^0.15.1"},"_npmOperationalInternal":{"tmp":"tmp/http-vary_1.0.2_1766802469984_0.8244226913164758","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"http-vary","version":"1.0.3","description":"A minimal parser and utility for the HTTP Vary header.","keywords":["vary","http","header","headers","cache","caching","http-cache","vary-header","rfc9110","rfc9111","cache-key","parser"],"homepage":"https://tinylibs.js.org/packages/http-vary","bugs":{"url":"https://github.com/arthurfiorette/tinylibs/issues"},"repository":{"type":"git","url":"git+https://github.com/arthurfiorette/tinylibs.git","directory":"packages/http-vary"},"license":"MIT","author":{"name":"Arthur Fiorette","email":"npm@arthur.place"},"sideEffects":false,"main":"dist/index.js","umd:main":"dist/index.umd.js","unpkg":"dist/index.umd.js","module":"dist/index.mjs","source":"src/index.ts","types":"dist/index.d.ts","devDependencies":{"microbundle":"^0.15.1"},"scripts":{"build":"microbundle --tsconfig tsconfig.build.json","test":"jest --coverage"},"_id":"http-vary@1.0.3","_integrity":"sha512-sx7Y8YTqF3o0mFJJvF66n8dbaE8v3liV1RgCz46XP5xK7dnzyZHvwMWRA115q5kjbCPBV65/nOMlgW54WLyiag==","_resolved":"/tmp/85b1f405439cc2ff603869d4da4bd4d9/http-vary-1.0.3.tgz","_from":"file:http-vary-1.0.3.tgz","_nodeVersion":"24.12.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-sx7Y8YTqF3o0mFJJvF66n8dbaE8v3liV1RgCz46XP5xK7dnzyZHvwMWRA115q5kjbCPBV65/nOMlgW54WLyiag==","shasum":"bacf8fccf31294577c1dc97d6cec479dde1e7741","tarball":"https://registry.npmjs.org/http-vary/-/http-vary-1.0.3.tgz","fileCount":23,"unpackedSize":51616,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/http-vary@1.0.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDf6jWPB/eM4ih8ldoT4/wE3wocLe0KLjESGERgWKcJ4AiAA4wz5km2LKTWHtg5RFnX+irOJTQYR4079NtvIgYhmYQ=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d892ed95-daac-4c1e-a59a-276b0cb5cca7"}},"directories":{},"maintainers":[{"name":"hazork","email":"arthur.fiorette@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/http-vary_1.0.3_1766803344584_0.5156942429147513"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-27T02:06:27.494Z","modified":"2025-12-27T02:42:25.077Z","0.0.1":"2025-12-27T02:06:27.641Z","1.0.0":"2025-12-27T02:08:05.542Z","1.0.1":"2025-12-27T02:17:33.035Z","1.0.2":"2025-12-27T02:27:50.143Z","1.0.3":"2025-12-27T02:42:24.726Z"},"bugs":{"url":"https://github.com/arthurfiorette/tinylibs/issues"},"author":{"name":"Arthur Fiorette","email":"npm@arthur.place"},"license":"MIT","homepage":"https://tinylibs.js.org/packages/http-vary","keywords":["vary","http","header","headers","cache","caching","http-cache","vary-header","rfc9110","rfc9111","cache-key","parser"],"repository":{"type":"git","url":"git+https://github.com/arthurfiorette/tinylibs.git","directory":"packages/http-vary"},"description":"A minimal parser and utility for the HTTP Vary header.","maintainers":[{"name":"hazork","email":"arthur.fiorette@gmail.com"}],"readme":"<br />\n\n[![Issues](https://img.shields.io/github/issues/arthurfiorette/tinylibs?logo=github&label=Issues)](https://github.com/arthurfiorette/tinylibs/issues)\n[![Stars](https://img.shields.io/github/stars/arthurfiorette/tinylibs?logo=github&label=Stars)](https://github.com/arthurfiorette/tinylibs/stargazers)\n[![License](https://img.shields.io/github/license/arthurfiorette/tinylibs?logo=githu&label=License)](https://github.com/arthurfiorette/tinylibs/blob/main/LICENSE)\n[![Codecov](https://codecov.io/gh/arthurfiorette/tinylibs/branch/main/graph/badge.svg?token=ML0KGCU0VM)](https://codecov.io/gh/arthurfiorette/tinylibs)\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Farthurfiorette%2Ftinylibs.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Farthurfiorette%2Ftinylibs?ref=badge_shield)\n[![Join the chat at https://gitter.im/tinylibs-js-org/community](https://badges.gitter.im/tinylibs-js-org/community.svg)](https://gitter.im/tinylibs-js-org/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)\n[![Speed Blazing](https://img.shields.io/badge/speed-blazing%20%F0%9F%94%A5-brightgreen.svg)](https://twitter.com/acdlite/status/974390255393505280)\n\n[![Latest Version](https://img.shields.io/npm/v/http-vary)](https://www.npmjs.com/package/http-vary)\n[![Downloads](https://img.shields.io/npm/dw/http-vary)](https://www.npmjs.com/package/http-vary)\n[![JsDelivr](https://data.jsdelivr.com/v1/package/npm/http-vary/badge?style=rounded)](https://www.jsdelivr.com/package/npm/http-vary)\n[![Bundlephobia](https://img.shields.io/bundlephobia/minzip/http-vary/latest?style=flat)](https://bundlephobia.com/package/http-vary@latest)\n[![Packagephobia](https://packagephobia.com/badge?p=http-vary@latest)](https://packagephobia.com/result?p=http-vary@latest)\n\n<br />\n\n<div align=\"center\">\n  <pre>\n  <h1>⌛<br />HTTP Vary</h1>\n  </pre>\n  <br />\n</div>\n\n<h3 align=\"center\">\n  <code>HTTP Vary</code> is a minimal parser and utility for the <a href=\"https://www.rfc-editor.org/rfc/rfc9110.html#name-vary\" target=\"_blank\">Vary</a> header (RFC 9110).\n  <br />\n  <br />\n</h3>\n\n<br />\n\n## Table of Contents\n\n- [Table of Contents](#table-of-contents)\n- [Installing](#installing)\n  - [Node](#node)\n  - [Browser](#browser)\n  - [Url Import](#url-import)\n- [Getting Started](#getting-started)\n  - [Usage](#usage)\n- [Understanding Wildcard Behavior](#understanding-wildcard-behavior)\n- [License](#license)\n\n<br />\n\n## Installing\n\n### Node\n\n```sh\nnpm install http-vary # or yarn add http-vary\n```\n\n```js\nconst { parse, compare } = require('http-vary');\nimport { parse, compare } from 'http-vary';\n```\n\n### Browser\n\n```html\n<script\n  crossorigin\n  src=\"https://cdn.jsdelivr.net/npm/http-vary@latest/dist/index.umd.js\"\n></script>\n```\n\n```js\nconst { parse, compare } = window.httpVary;\n```\n\n### Url Import\n\n```ts\nimport { parse, compare } from 'https://cdn.skypack.dev/http-vary@latest';\n```\n\n<br />\n\n## Getting Started\n\nThis package is a parser and utility for the HTTP Vary header as defined in\n[RFC 9110 Section 12.5.5](https://www.rfc-editor.org/rfc/rfc9110.html#name-vary). The Vary\nheader indicates which request headers affect the response, enabling proper HTTP caching\nbehavior. You can parse a Vary header string with [`parse()`](./src/parse.ts) and compare\nrequest headers for cache equivalence with [`compare()`](./src/compare.ts).\n\nAll needed documentation is available in form of `TSDoc` comments.\n\n### Usage\n\n```ts\nimport { parse, compare, VaryHeader } from 'http-vary';\n\n// Parse a Vary header\nconst rawHeader = 'Accept-Encoding, User-Agent';\n\nconst vary = parse(rawHeader);\n// => ['accept-encoding', 'user-agent']\n\n// Parse wildcard\nconst wildcardVary = parse('*');\n// => '*'\n\n// Compare headers for cache equivalence\nconst headers1 = {\n  'Accept-Encoding': 'gzip',\n  'User-Agent': 'Chrome'\n};\n\nconst headers2 = {\n  'Accept-Encoding': 'gzip',\n  'User-Agent': 'Chrome',\n  Cookie: 'session=abc' // This header is ignored\n};\n\nconst isEquivalent = compare(vary, headers1, headers2);\n// => true (headers match for the fields specified in Vary)\n\n// Case-insensitive header matching (per RFC 9110)\nconst headers3 = {\n  'accept-encoding': 'gzip', // lowercase\n  'USER-AGENT': 'Chrome' // uppercase\n};\n\nconst caseInsensitiveMatch = compare(vary, headers1, headers3);\n// => true (header names are matched case-insensitively)\n\n// Wildcard always returns false\nconst wildcardMatch = compare('*', headers1, headers2);\n// => false (wildcard indicates response varies on aspects beyond headers)\n```\n\n<br />\n\n## Understanding Wildcard Behavior\n\nPer [RFC 9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-vary), `Vary: *` signals\nthat the response can vary based on **anything** about the request, including factors\nbeyond headers (e.g., client IP, time, server load, A/B testing). Since we cannot\ndetermine if two requests would receive the same response, `compare()` always returns\n`false` for wildcard, preventing incorrect cache hits.\n\n**TL;DR**: `Vary: *` means \"don't cache\" - always consult the origin server.\n\n<br />\n\n## License\n\nLicensed under the **MIT**. See [`LICENSE`](LICENSE) for more informations.\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Farthurfiorette%2Ftinylibs.svg?type=small)](https://app.fossa.com/projects/git%2Bgithub.com%2Farthurfiorette%2Ftinylibs?ref=badge_small)\n\n<br />\n","readmeFilename":"README.md"}