{"_id":"@mjackson/headers","_rev":"4245010","name":"@mjackson/headers","description":"A toolkit for working with HTTP headers in JavaScript","dist-tags":{"latest":"0.11.1"},"maintainers":[{"name":"mjackson","email":""}],"time":{"modified":"2026-03-29T21:29:19.000Z","created":"2024-08-06T08:59:12.716Z","0.11.1":"2025-06-06T00:45:34.513Z","0.11.0":"2025-06-06T00:01:08.169Z","0.10.0":"2025-01-27T20:01:54.632Z","0.9.0":"2024-12-20T15:32:06.922Z","0.8.0":"2024-11-14T23:40:48.982Z","0.7.2":"2024-08-29T15:56:15.789Z","0.7.1":"2024-08-28T21:37:58.371Z","0.7.0":"2024-08-28T06:57:58.369Z","0.6.1":"2024-08-13T17:17:50.002Z","0.6.0":"2024-08-13T16:34:41.187Z","0.5.1":"2024-08-06T15:45:42.816Z","0.5.0":"2024-08-06T08:59:12.716Z"},"users":{},"author":{"name":"Michael Jackson","email":"mjijackson@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/mjackson/remix-the-web.git","directory":"packages/headers"},"versions":{"0.11.1":{"name":"@mjackson/headers","version":"0.11.1","description":"A toolkit for working with HTTP headers in JavaScript","author":{"name":"Michael Jackson","email":"mjijackson@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/mjackson/remix-the-web.git","directory":"packages/headers"},"homepage":"https://github.com/mjackson/remix-the-web/tree/main/packages/headers#readme","type":"module","types":"./dist/headers.d.ts","module":"./dist/headers.js","main":"./dist/headers.cjs","exports":{".":{"types":"./dist/headers.d.ts","import":"./dist/headers.js","require":"./dist/headers.cjs","default":"./dist/headers.js"},"./package.json":"./package.json"},"devDependencies":{"@types/node":"^20.14.10","esbuild":"^0.20.0"},"keywords":["fetch","http","header","headers","http-headers","request-headers","response-headers","content-negotiation","cookies","set-cookie","cache-control","content-type","accept","accept-encoding","accept-language","content-disposition","if-none-match","etag","user-agent","host","last-modified"],"scripts":{"build:types":"tsc --project tsconfig.build.json","build:esm":"esbuild src/headers.ts --bundle --outfile=dist/headers.js --format=esm --platform=neutral --sourcemap","build:cjs":"esbuild src/headers.ts --bundle --outfile=dist/headers.cjs --format=cjs --platform=node --sourcemap","build":"pnpm run clean && pnpm run build:types && pnpm run build:esm && pnpm run build:cjs","clean":"rm -rf dist","test":"node --experimental-strip-types --disable-warning=ExperimentalWarning --test ./src/**/*.test.ts"},"_id":"@mjackson/headers@0.11.1","bugs":{"url":"https://github.com/mjackson/remix-the-web/issues"},"_integrity":"sha512-uXXhd4rtDdDwkqAuGef1nuafkCa1NlTmEc1Jzc0NL4YiA1yON1NFXuqJ3hOuKvNKQwkiDwdD+JJlKVyz4dunFA==","_resolved":"/tmp/4787e2f12e97e4d0b2ad2fce9f8c79e1/mjackson-headers-0.11.1.tgz","_from":"file:mjackson-headers-0.11.1.tgz","_nodeVersion":"22.16.0","_npmVersion":"10.9.2","dist":{"shasum":"f365aaf775aa79e2354dfb2877fa81e4ba314b84","size":90963,"noattachment":false,"key":"/@mjackson/headers/-/@mjackson/headers-0.11.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@mjackson/headers/download/@mjackson/headers-0.11.1.tgz"},"_npmUser":{"name":"mjackson","email":"mjijackson+npm@gmail.com"},"directories":{},"maintainers":[{"name":"mjackson","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/headers_0.11.1_1749170734312_0.19664283368412505"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-06-06T00:45:34.513Z","publish_time":1749170734513,"_source_registry_name":"default","_cnpm_publish_time":1749170734513},"0.11.0":{"name":"@mjackson/headers","version":"0.11.0","description":"A toolkit for working with HTTP headers in JavaScript","author":{"name":"Michael Jackson","email":"mjijackson@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/mjackson/remix-the-web.git","directory":"packages/headers"},"homepage":"https://github.com/mjackson/remix-the-web/tree/main/packages/headers#readme","type":"module","main":"./dist/headers.cjs","module":"./dist/headers.js","types":"./dist/headers.d.ts","exports":{".":{"types":"./dist/headers.d.ts","import":"./dist/headers.js","require":"./dist/headers.cjs","default":"./dist/headers.js"},"./package.json":"./package.json"},"devDependencies":{"@types/node":"^20.14.10","esbuild":"^0.20.0"},"keywords":["fetch","http","header","headers","http-headers","request-headers","response-headers","content-negotiation","cookies","set-cookie","cache-control","content-type","accept","accept-encoding","accept-language","content-disposition","if-none-match","etag","user-agent","host","last-modified"],"scripts":{"clean":"rm -rf dist","build:types":"tsc --project tsconfig.build.json","build:esm":"esbuild src/headers.ts --bundle --outfile=dist/headers.js --format=esm --platform=neutral --minify --sourcemap","build:cjs":"esbuild src/headers.ts --bundle --outfile=dist/headers.cjs --format=cjs --platform=node --minify --sourcemap","build":"pnpm run clean && pnpm run build:types && pnpm run build:esm && pnpm run build:cjs","test":"node --experimental-strip-types --disable-warning=ExperimentalWarning --test ./src/**/*.test.ts"},"_id":"@mjackson/headers@0.11.0","bugs":{"url":"https://github.com/mjackson/remix-the-web/issues"},"_integrity":"sha512-fDwqlGu8dkdx/GB/cdwHm7RgwRsOtGxFWhDQWGSrcMu0rmKS2fy+QzBTLq+260uAuo0IwE+3WgSHNKSSKBzR9Q==","_resolved":"/tmp/1ba1eb9d2d4d931348097da132cc0bbd/mjackson-headers-0.11.0.tgz","_from":"file:mjackson-headers-0.11.0.tgz","_nodeVersion":"22.16.0","_npmVersion":"10.9.2","dist":{"shasum":"fc7a6a78cb34354aef0e4727c870c609b964e9c1","size":82478,"noattachment":false,"key":"/@mjackson/headers/-/@mjackson/headers-0.11.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@mjackson/headers/download/@mjackson/headers-0.11.0.tgz"},"_npmUser":{"name":"mjackson","email":"mjijackson+npm@gmail.com"},"directories":{},"maintainers":[{"name":"mjackson","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/headers_0.11.0_1749168067957_0.8852134193934542"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-06-06T00:01:08.169Z","publish_time":1749168068169,"_source_registry_name":"default","_cnpm_publish_time":1749168068169},"0.10.0":{"name":"@mjackson/headers","version":"0.10.0","description":"A toolkit for working with HTTP headers in JavaScript","author":{"name":"Michael Jackson","email":"mjijackson@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/mjackson/remix-the-web.git","directory":"packages/headers"},"homepage":"https://github.com/mjackson/remix-the-web/tree/main/packages/headers#readme","type":"module","types":"./dist/headers.d.ts","main":"./dist/headers.js","exports":{".":{"module-sync":{"types":"./dist/headers.d.ts","default":"./dist/headers.js"},"import":{"types":"./dist/headers.d.ts","default":"./dist/headers.js"},"require":{"types":"./dist/headers.d.cts","default":"./dist/headers.cjs"},"default":{"types":"./dist/headers.d.ts","default":"./dist/headers.js"}},"./package.json":"./package.json"},"devDependencies":{"@types/node":"^20.14.10","tsup":"^8.3.5"},"keywords":["fetch","http","header","headers"],"scripts":{"build":"tsup","test":"node --experimental-strip-types --disable-warning=ExperimentalWarning --test ./src/**/*.test.ts"},"_id":"@mjackson/headers@0.10.0","bugs":{"url":"https://github.com/mjackson/remix-the-web/issues"},"_integrity":"sha512-U1Eu1gF979k7ZoIBsJyD+T5l9MjtPONsZfoXfktsQHPJD0s7SokBGx+tLKDLsOY+gzVYAWS0yRFDNY8cgbQzWQ==","_resolved":"/tmp/71adbe4146333eededa95dd0da212458/mjackson-headers-0.10.0.tgz","_from":"file:mjackson-headers-0.10.0.tgz","_nodeVersion":"22.13.0","_npmVersion":"10.9.2","dist":{"shasum":"89dff58fd1287024e5c0c7ca4a83831551e164d6","size":35683,"noattachment":false,"key":"/@mjackson/headers/-/@mjackson/headers-0.10.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@mjackson/headers/download/@mjackson/headers-0.10.0.tgz"},"_npmUser":{"name":"mjackson","email":"mjijackson+npm@gmail.com"},"directories":{},"maintainers":[{"name":"mjackson","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/headers_0.10.0_1738008114423_0.03628335195766308"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-01-27T20:01:54.632Z","publish_time":1738008114632,"_source_registry_name":"default","_cnpm_publish_time":1738008114632},"0.9.0":{"name":"@mjackson/headers","version":"0.9.0","description":"A toolkit for working with HTTP headers in JavaScript","author":{"name":"Michael Jackson","email":"mjijackson@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/mjackson/remix-the-web.git","directory":"packages/headers"},"homepage":"https://github.com/mjackson/remix-the-web/tree/main/packages/headers#readme","type":"module","types":"./dist/headers.d.ts","main":"./dist/headers.js","exports":{".":{"module-sync":{"types":"./dist/headers.d.ts","default":"./dist/headers.js"},"import":{"types":"./dist/headers.d.ts","default":"./dist/headers.js"},"require":{"types":"./dist/headers.d.cts","default":"./dist/headers.cjs"},"default":{"types":"./dist/headers.d.ts","default":"./dist/headers.js"}},"./package.json":"./package.json"},"devDependencies":{"@types/node":"^20.14.10","tsup":"^8.3.5"},"keywords":["fetch","http","header","headers"],"scripts":{"build":"tsup","test":"node --experimental-strip-types --disable-warning=ExperimentalWarning --test ./src/**/*.test.ts"},"_id":"@mjackson/headers@0.9.0","bugs":{"url":"https://github.com/mjackson/remix-the-web/issues"},"_integrity":"sha512-1WFCu2iRaqbez9hcYYI611vcH1V25R+fDfOge/CyKc8sdbzniGfy/FRhNd3DgvFF4ZEEX2ayBrvFHLtOpfvadw==","_resolved":"/tmp/9038e0453b08ce73f4d62651462f748b/mjackson-headers-0.9.0.tgz","_from":"file:mjackson-headers-0.9.0.tgz","_nodeVersion":"22.12.0","_npmVersion":"10.9.0","dist":{"shasum":"2601ab67b746f0b7a2996532fe7f3ef605b92a83","size":34256,"noattachment":false,"key":"/@mjackson/headers/-/@mjackson/headers-0.9.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@mjackson/headers/download/@mjackson/headers-0.9.0.tgz"},"_npmUser":{"name":"mjackson","email":"mjijackson+npm@gmail.com"},"directories":{},"maintainers":[{"name":"mjackson","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/headers_0.9.0_1734708726681_0.7118779430218982"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-12-20T15:32:06.922Z","publish_time":1734708726922,"_source_registry_name":"default","_cnpm_publish_time":1734708726922},"0.8.0":{"name":"@mjackson/headers","version":"0.8.0","description":"A toolkit for working with HTTP headers in JavaScript","author":{"name":"Michael Jackson","email":"mjijackson@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/mjackson/remix-the-web.git","directory":"packages/headers"},"homepage":"https://github.com/mjackson/remix-the-web/tree/main/packages/headers#readme","type":"module","types":"./dist/headers.d.ts","main":"./dist/headers.js","exports":{".":{"module-sync":{"types":"./dist/headers.d.ts","default":"./dist/headers.js"},"import":{"types":"./dist/headers.d.ts","default":"./dist/headers.js"},"require":{"types":"./dist/headers.d.cts","default":"./dist/headers.cjs"},"default":{"types":"./dist/headers.d.ts","default":"./dist/headers.js"}},"./package.json":"./package.json"},"devDependencies":{"@swc-node/register":"^1.10.9","@types/node":"^20.14.10","tsup":"^8.3.5","typescript":"^5.6.3"},"keywords":["fetch","http","header","headers"],"scripts":{"build":"tsup","test":"node --import @swc-node/register/esm-register --test ./src/**/*.spec.ts","release":"node --import @swc-node/register/esm-register ../../scripts/release.ts"},"_id":"@mjackson/headers@0.8.0","bugs":{"url":"https://github.com/mjackson/remix-the-web/issues"},"_integrity":"sha512-A6nE9ZKTGX1hTHQOeoYn/f7+xRTgzixHWu9jtZ8zYgZYq30MPtZIRXqEyY8bWaIILr+zWdmUPQg/R/8e+e/8Nw==","_resolved":"/private/var/folders/n5/1lxhnzk56hg6b7vnl558364m0000gn/T/e56a8a1bec71d20e27f9efcced1a8a25/mjackson-headers-0.8.0.tgz","_from":"file:mjackson-headers-0.8.0.tgz","_nodeVersion":"22.8.0","_npmVersion":"10.8.2","dist":{"shasum":"bd32f8730a547dd0bbd101ca7382bdd73ccc0fd4","size":23642,"noattachment":false,"key":"/@mjackson/headers/-/@mjackson/headers-0.8.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@mjackson/headers/download/@mjackson/headers-0.8.0.tgz"},"_npmUser":{"name":"mjackson","email":"mjijackson+npm@gmail.com"},"directories":{},"maintainers":[{"name":"mjackson","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/headers_0.8.0_1731627648780_0.3713850000864398"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-11-14T23:40:48.982Z","publish_time":1731627648982,"_source_registry_name":"default","_cnpm_publish_time":1731627648982},"0.7.2":{"name":"@mjackson/headers","version":"0.7.2","description":"A toolkit for working with HTTP headers in JavaScript","author":{"name":"Michael Jackson","email":"mjijackson@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/mjackson/remix-the-web.git","directory":"packages/headers"},"type":"module","exports":{".":"./dist/headers.js","./package.json":"./package.json"},"devDependencies":{"@types/node":"^20.14.10"},"scripts":{"build":"tsc --outDir dist --project tsconfig.lib.json","test":"node --import @swc-node/register/esm-register --test ./src/**/*.spec.ts","prepare":"pnpm run build"},"keywords":["fetch","http","header","headers"],"nx":{"name":"headers"},"_id":"@mjackson/headers@0.7.2","gitHead":"174448e95390a3d28b2160ebbf6f20dabad5da94","bugs":{"url":"https://github.com/mjackson/remix-the-web/issues"},"homepage":"https://github.com/mjackson/remix-the-web#readme","_nodeVersion":"22.1.0","_npmVersion":"10.7.0","dist":{"shasum":"ab6926d67b73aa9b9eceac4083029e990de83ff8","size":15881,"noattachment":false,"key":"/@mjackson/headers/-/@mjackson/headers-0.7.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/@mjackson/headers/download/@mjackson/headers-0.7.2.tgz"},"_npmUser":{"name":"mjackson","email":"mjijackson+npm@gmail.com"},"directories":{},"maintainers":[{"name":"mjackson","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/headers_0.7.2_1724946975615_0.29854197165198504"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-08-29T15:56:15.789Z","publish_time":1724946975789,"_source_registry_name":"default","_cnpm_publish_time":1724946975789},"0.7.1":{"name":"@mjackson/headers","version":"0.7.1","description":"A toolkit for working with HTTP headers in JavaScript","author":{"name":"Michael Jackson","email":"mjijackson@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/mjackson/remix-the-web.git","directory":"packages/headers"},"type":"module","exports":{".":"./dist/headers.js","./package.json":"./package.json"},"devDependencies":{"@types/node":"^20.14.10"},"keywords":["fetch","http","header","headers"],"scripts":{"build":"tsc --outDir dist --project tsconfig.lib.json","test":"node --import @swc-node/register/esm-register --test ./src/**/*.spec.ts"},"_id":"@mjackson/headers@0.7.1","bugs":{"url":"https://github.com/mjackson/remix-the-web/issues"},"homepage":"https://github.com/mjackson/remix-the-web#readme","_integrity":"sha512-6GYVVgTii9qsDeKA/980ZD460ZZjwzEyhxeriHOFVERiMGhjE08Jd+LYkVWG1tD/V4wKHeMW005V9gk2bZ/JzA==","_resolved":"/private/var/folders/n5/1lxhnzk56hg6b7vnl558364m0000gn/T/f466dc28a1151e69d3fb25af43260f3a/mjackson-headers-0.7.1.tgz","_from":"file:mjackson-headers-0.7.1.tgz","_nodeVersion":"22.1.0","_npmVersion":"10.7.0","dist":{"shasum":"ff95d6faa3d85366c9debd788c95b3ccbe3efce9","size":15914,"noattachment":false,"key":"/@mjackson/headers/-/@mjackson/headers-0.7.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@mjackson/headers/download/@mjackson/headers-0.7.1.tgz"},"_npmUser":{"name":"mjackson","email":"mjijackson+npm@gmail.com"},"directories":{},"maintainers":[{"name":"mjackson","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/headers_0.7.1_1724881078194_0.9597866257230647"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-08-28T21:37:58.371Z","publish_time":1724881078371,"_source_registry_name":"default","_cnpm_publish_time":1724881078371},"0.7.0":{"name":"@mjackson/headers","version":"0.7.0","keywords":["fetch","http","header","headers"],"author":{"name":"Michael Jackson","email":"mjijackson@gmail.com"},"license":"MIT","_id":"@mjackson/headers@0.7.0","maintainers":[{"name":"mjackson","email":""}],"homepage":"https://github.com/mjackson/remix-the-web#readme","bugs":{"url":"https://github.com/mjackson/remix-the-web/issues"},"dist":{"shasum":"fc0e563a29a70e82516f20c3c2a5de5def4d5337","size":13707,"noattachment":false,"key":"/@mjackson/headers/-/@mjackson/headers-0.7.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@mjackson/headers/download/@mjackson/headers-0.7.0.tgz"},"type":"module","exports":{".":"./dist/headers.js","./package.json":"./package.json"},"gitHead":"063feddd4d250fa07513f9958a4db50c986f436d","scripts":{"test":"node --import @swc-node/register/esm-register --test ./src/**/*.spec.ts","build":"tsc --outDir dist --project tsconfig.lib.json","prepare":"pnpm run build"},"_npmUser":{"name":"mjackson","email":"mjijackson+npm@gmail.com"},"repository":{"url":"git+https://github.com/mjackson/remix-the-web.git","type":"git","directory":"packages/headers"},"_npmVersion":"10.7.0","description":"A toolkit for working with HTTP headers in JavaScript","directories":{},"_nodeVersion":"22.1.0","_hasShrinkwrap":false,"devDependencies":{"@types/node":"^20.14.10"},"_npmOperationalInternal":{"tmp":"tmp/headers_0.7.0_1724828278200_0.20057142924521432","host":"s3://npm-registry-packages"},"_cnpmcore_publish_time":"2024-08-28T06:57:58.369Z","publish_time":1724828278369,"_source_registry_name":"default","_cnpm_publish_time":1724828278369},"0.6.1":{"name":"@mjackson/headers","version":"0.6.1","description":"A toolkit for working with HTTP headers in JavaScript","author":{"name":"Michael Jackson","email":"mjijackson@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/mjackson/headers.git"},"type":"module","exports":{".":"./dist/headers.js","./package.json":"./package.json"},"devDependencies":{"@types/node":"^20.14.10","prettier":"^3.3.3","tsimp":"^2.0.11","typescript":"^5.5.3"},"scripts":{"clean":"git clean -fdX .","build":"tsc --outDir dist --project tsconfig.lib.json","test":"node --import tsimp/import --test ./src/**/*.spec.ts","prepare":"npm run build","version":"node scripts/version.js"},"packageManager":"pnpm@9.4.0","keywords":["fetch","http","header","headers"],"_id":"@mjackson/headers@0.6.1","gitHead":"0aa99ef15563422b627284576dad898a0d60c4ea","bugs":{"url":"https://github.com/mjackson/headers/issues"},"homepage":"https://github.com/mjackson/headers#readme","_nodeVersion":"20.16.0","_npmVersion":"10.8.1","dist":{"shasum":"f0b1a70af6837ff76e651054e77178a42c28bc86","size":12755,"noattachment":false,"key":"/@mjackson/headers/-/@mjackson/headers-0.6.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@mjackson/headers/download/@mjackson/headers-0.6.1.tgz"},"_npmUser":{"name":"mjackson","email":"mjijackson+npm@gmail.com"},"directories":{},"maintainers":[{"name":"mjackson","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/headers_0.6.1_1723569469774_0.09312803076446019"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-08-13T17:17:50.002Z","publish_time":1723569470002,"_source_registry_name":"default","_cnpm_publish_time":1723569470002},"0.6.0":{"name":"@mjackson/headers","version":"0.6.0","keywords":["fetch","http","header","headers"],"author":{"name":"Michael Jackson","email":"mjijackson@gmail.com"},"license":"MIT","_id":"@mjackson/headers@0.6.0","maintainers":[{"name":"mjackson","email":""}],"homepage":"https://github.com/mjackson/headers#readme","bugs":{"url":"https://github.com/mjackson/headers/issues"},"dist":{"shasum":"be77693441a84da78b72d5d48f63133b8c95936f","size":12800,"noattachment":false,"key":"/@mjackson/headers/-/@mjackson/headers-0.6.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@mjackson/headers/download/@mjackson/headers-0.6.0.tgz"},"type":"module","exports":{".":"./dist/headers.js","./package.json":"./package.json"},"gitHead":"ec440908f3df10001b171a36591b288de5a42c6b","scripts":{"test":"node --import tsimp/import --test ./src/**/*.spec.ts","build":"tsc --outDir dist --project tsconfig.lib.json","clean":"git clean -fdX .","prepare":"npm run build","version":"node scripts/version.js"},"_npmUser":{"name":"mjackson","email":"mjijackson+npm@gmail.com"},"repository":{"url":"git+https://github.com/mjackson/headers.git","type":"git"},"_npmVersion":"10.8.1","description":"A toolkit for working with HTTP headers in JavaScript","directories":{},"_nodeVersion":"20.16.0","_hasShrinkwrap":false,"packageManager":"pnpm@9.4.0","devDependencies":{"tsimp":"^2.0.11","prettier":"^3.3.3","typescript":"^5.5.3","@types/node":"^20.14.10"},"_npmOperationalInternal":{"tmp":"tmp/headers_0.6.0_1723566880983_0.9342583383302991","host":"s3://npm-registry-packages"},"_cnpmcore_publish_time":"2024-08-13T16:34:41.187Z","publish_time":1723566881187,"_source_registry_name":"default","_cnpm_publish_time":1723566881187},"0.5.1":{"name":"@mjackson/headers","version":"0.5.1","description":"A toolkit for working with HTTP headers in JavaScript","author":{"name":"Michael Jackson","email":"mjijackson@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/mjackson/headers.git"},"type":"module","exports":{".":"./dist/headers.js","./package.json":"./package.json"},"devDependencies":{"@types/node":"^20.14.10","prettier":"^3.3.3","tsimp":"^2.0.11","typescript":"^5.5.3"},"scripts":{"clean":"git clean -fdX .","build":"tsc --outDir dist --project tsconfig.lib.json","test":"node --import tsimp/import --test ./src/**/*.spec.ts","prepare":"npm run build"},"packageManager":"pnpm@9.4.0","keywords":["fetch","http","header","headers"],"_id":"@mjackson/headers@0.5.1","gitHead":"68e043d55a87f58077faf8ba31438a28ba858e0e","bugs":{"url":"https://github.com/mjackson/headers/issues"},"homepage":"https://github.com/mjackson/headers#readme","_nodeVersion":"20.16.0","_npmVersion":"10.8.1","dist":{"shasum":"2d01fdd8909737b88438825b25ce21a14bfed182","size":10265,"noattachment":false,"key":"/@mjackson/headers/-/@mjackson/headers-0.5.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@mjackson/headers/download/@mjackson/headers-0.5.1.tgz"},"_npmUser":{"name":"mjackson","email":"mjijackson+npm@gmail.com"},"directories":{},"maintainers":[{"name":"mjackson","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/headers_0.5.1_1722959142649_0.2110271427113244"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-08-06T15:45:42.816Z","publish_time":1722959142816,"_source_registry_name":"default","_cnpm_publish_time":1722959142816},"0.5.0":{"name":"@mjackson/headers","version":"0.5.0","description":"A toolkit for working with HTTP headers in JavaScript","author":{"name":"Michael Jackson","email":"mjijackson@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/mjackson/headers.git"},"type":"module","exports":{".":"./dist/headers.js","./package.json":"./package.json"},"devDependencies":{"@types/node":"^20.14.10","prettier":"^3.3.3","tsimp":"^2.0.11","typescript":"^5.5.3"},"scripts":{"clean":"git clean -fdX .","build":"tsc --outDir dist --project tsconfig.lib.json","test":"node --import tsimp/import --test ./src/**/*.spec.ts","prepare":"npm run build"},"packageManager":"pnpm@9.4.0","keywords":["fetch","http","header","headers"],"_id":"@mjackson/headers@0.5.0","gitHead":"9038ed0e5694e64297e952502159f4198de14a0c","bugs":{"url":"https://github.com/mjackson/headers/issues"},"homepage":"https://github.com/mjackson/headers#readme","_nodeVersion":"20.16.0","_npmVersion":"10.8.1","dist":{"shasum":"217980d66256b5bd48b710109d2b50bfbe66edec","size":10266,"noattachment":false,"key":"/@mjackson/headers/-/@mjackson/headers-0.5.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@mjackson/headers/download/@mjackson/headers-0.5.0.tgz"},"_npmUser":{"name":"mjackson","email":"mjijackson+npm@gmail.com"},"directories":{},"maintainers":[{"name":"mjackson","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/headers_0.5.0_1722934752550_0.09707739538297178"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-08-06T08:59:12.716Z","publish_time":1722934752716,"_source_registry_name":"default","_cnpm_publish_time":1722934752716}},"readme":"# headers\n\nTired of manually parsing and stringifying HTTP header values in JavaScript? `headers` supercharges the standard `Headers` interface, providing a robust toolkit for effortless and type-safe header manipulation.\n\nHTTP headers are packed with critical information—from content negotiation and caching directives to authentication tokens and file metadata. While the native `Headers` API provides a basic string-based interface, it leaves the complexities of parsing specific header formats (like `Accept`, `Content-Type`, or `Set-Cookie`) entirely up to you.\n\n`headers` solves this by offering:\n\n- **Type-Safe Accessors:** Interact with complex header values (e.g., media types, quality factors, cookie attributes) through strongly-typed properties and methods, eliminating guesswork and manual parsing.\n- **Automatic Parsing & Stringification:** The library intelligently handles the parsing of raw header strings into structured objects and stringifies your structured data back into spec-compliant header values.\n- **Fluent Interface:** Enjoy a more expressive and developer-friendly API for reading and writing header information.\n- **Drop-in Enhancement:** As a subclass of the standard `Headers` object, it can be used anywhere a `Headers` object is expected, providing progressive enhancement to your existing code.\n- **Individual Header Utilities:** For fine-grained control, use standalone utility classes for specific headers, perfect for scenarios outside of a full `Headers` object.\n\nUnlock a more powerful and elegant way to work with HTTP headers in your JavaScript and TypeScript projects!\n\n## Installation\n\n```sh\nnpm install @mjackson/headers\n```\n\n## Overview\n\nThe following should give you a sense of what kinds of things you can do with this library:\n\n```ts\nimport Headers from '@mjackson/headers';\n\nlet headers = new Headers();\n\n// Accept\nheaders.accept = 'text/html, text/*;q=0.9';\n\nheaders.accept.mediaTypes; // [ 'text/html', 'text/*' ]\nObject.fromEntries(headers.accept.entries()); // { 'text/html': 1, 'text/*': 0.9 }\n\nheaders.accept.accepts('text/html'); // true\nheaders.accept.accepts('text/plain'); // true\nheaders.accept.accepts('image/jpeg'); // false\n\nheaders.accept.getPreferred(['text/plain', 'text/html']); // 'text/html'\n\nheaders.accept.set('text/plain', 0.9);\nheaders.accept.set('text/*', 0.8);\n\nheaders.get('Accept'); // 'text/html,text/plain;q=0.9,text/*;q=0.8'\n\n// Accept-Encoding\nheaders.acceptEncoding = 'gzip, deflate;q=0.8';\n\nheaders.acceptEncoding.encodings; // [ 'gzip', 'deflate' ]\nObject.fromEntries(headers.acceptEncoding.entries()); // { 'gzip': 1, 'deflate': 0.8 }\n\nheaders.acceptEncoding.accepts('gzip'); // true\nheaders.acceptEncoding.accepts('br'); // false\n\nheaders.acceptEncoding.getPreferred(['gzip', 'deflate']); // 'gzip'\n\n// Accept-Language\nheaders.acceptLanguage = 'en-US, en;q=0.9';\n\nheaders.acceptLanguage.languages; // [ 'en-us', 'en' ]\nObject.fromEntries(headers.acceptLanguage.entries()); // { 'en-us': 1, en: 0.9 }\n\nheaders.acceptLanguage.accepts('en'); // true\nheaders.acceptLanguage.accepts('ja'); // false\n\nheaders.acceptLanguage.getPreferred(['en-US', 'en-GB']); // 'en-US'\nheaders.acceptLanguage.getPreferred(['en', 'fr']); // 'en'\n\n// Accept-Ranges\nheaders.acceptRanges = 'bytes';\n\n// Connection\nheaders.connection = 'close';\n\n// Content-Type\nheaders.contentType = 'application/json; charset=utf-8';\n\nheaders.contentType.mediaType; // \"application/json\"\nheaders.contentType.charset; // \"utf-8\"\n\nheaders.contentType.charset = 'iso-8859-1';\n\nheaders.get('Content-Type'); // \"application/json; charset=iso-8859-1\"\n\n// Content-Disposition\nheaders.contentDisposition =\n  'attachment; filename=\"example.pdf\"; filename*=UTF-8\\'\\'%E4%BE%8B%E5%AD%90.pdf';\n\nheaders.contentDisposition.type; // 'attachment'\nheaders.contentDisposition.filename; // 'example.pdf'\nheaders.contentDisposition.filenameSplat; // 'UTF-8\\'\\'%E4%BE%8B%E5%AD%90.pdf'\nheaders.contentDisposition.preferredFilename; // '例子.pdf'\n\n// Cookie\nheaders.cookie = 'session_id=abc123; user_id=12345';\n\nheaders.cookie.get('session_id'); // 'abc123'\nheaders.cookie.get('user_id'); // '12345'\n\nheaders.cookie.set('theme', 'dark');\nheaders.get('Cookie'); // 'session_id=abc123; user_id=12345; theme=dark'\n\n// Host\nheaders.host = 'example.com';\n\n// If-None-Match\nheaders.ifNoneMatch = ['67ab43', '54ed21'];\nheaders.get('If-None-Match'); // '\"67ab43\", \"54ed21\"'\n\n// Last-Modified\nheaders.lastModified = new Date();\n// or headers.lastModified = new Date().getTime();\nheaders.get('Last-Modified'); // 'Fri, 20 Dec 2024 08:08:05 GMT'\n\n// Location\nheaders.location = 'https://example.com';\n\n// Referer\nheaders.referer = 'https://example.com/';\n\n// Set-Cookie\nheaders.setCookie = ['session_id=abc123; Path=/; HttpOnly'];\n\nheaders.setCookie[0].name; // 'session_id'\nheaders.setCookie[0].value; // 'abc123'\nheaders.setCookie[0].path; // '/'\nheaders.setCookie[0].httpOnly; // true\n\n// Modifying Set-Cookie attributes\nheaders.setCookie[0].maxAge = 3600;\nheaders.setCookie[0].secure = true;\n\nheaders.get('Set-Cookie'); // 'session_id=abc123; Path=/; HttpOnly; Max-Age=3600; Secure'\n\n// Setting multiple cookies is easy, it's just an array\nheaders.setCookie.push('user_id=12345; Path=/api; Secure');\n// or headers.setCookie = [...headers.setCookie, '...']\n\n// Accessing multiple Set-Cookie headers\nfor (let cookie of headers.getSetCookie()) {\n  console.log(cookie);\n}\n// session_id=abc123; Path=/; HttpOnly; Max-Age=3600; Secure\n// user_id=12345; Path=/api; Secure\n```\n\n`Headers` can be initialized with an object config:\n\n```ts\nlet headers = new Headers({\n  contentType: {\n    mediaType: 'text/html',\n    charset: 'utf-8',\n  },\n  setCookie: [\n    { name: 'session', value: 'abc', path: '/' },\n    { name: 'theme', value: 'dark', expires: new Date('2021-12-31T23:59:59Z') },\n  ],\n});\n\nconsole.log(`${headers}`);\n// Content-Type: text/html; charset=utf-8\n// Set-Cookie: session=abc; Path=/\n// Set-Cookie: theme=dark; Expires=Fri, 31 Dec 2021 23:59:59 GMT\n```\n\n`Headers` works just like [DOM's `Headers`](https://developer.mozilla.org/en-US/docs/Web/API/Headers) (it's a subclass) so you can use them anywhere you need a `Headers`.\n\n```ts\nimport Headers from '@mjackson/headers';\n\n// Use in a fetch()\nlet response = await fetch('https://example.com', {\n  headers: new Headers(),\n});\n\n// Convert from DOM Headers\nlet headers = new Headers(response.headers);\n\nheaders.set('Content-Type', 'text/html');\nheaders.get('Content-Type'); // \"text/html\"\n```\n\nIf you're familiar with using DOM `Headers`, everything works as you'd expect.\n\n`Headers` are iterable:\n\n```ts\nlet headers = new Headers({\n  'Content-Type': 'application/json',\n  'X-API-Key': 'secret-key',\n  'Accept-Language': 'en-US,en;q=0.9',\n});\n\nfor (let [name, value] of headers) {\n  console.log(`${name}: ${value}`);\n}\n// Content-Type: application/json\n// X-Api-Key: secret-key\n// Accept-Language: en-US,en;q=0.9\n```\n\nIf you're assembling HTTP messages, you can easily convert to a multiline string suitable for using as a Request/Response header block:\n\n```ts\nlet headers = new Headers({\n  'Content-Type': 'application/json',\n  'Accept-Language': 'en-US,en;q=0.9',\n});\n\nconsole.log(`${headers}`);\n// Content-Type: application/json\n// Accept-Language: en-US,en;q=0.9\n```\n\n## Individual Header Utility Classes\n\nIn addition to the high-level `Headers` API, `headers` also provides a rich set of primitives you can use to work with just about any complex HTTP header value. Each header class includes a spec-compliant parser (the constructor), stringifier (`toString`), and getters/setters for all relevant attributes. Classes for headers that contain a list of fields, like `Cookie`, are iterable.\n\nIf you need support for a header that isn't listed here, please [send a PR](https://github.com/mjackson/remix-the-web/pulls)! The goal is to have first-class support for all common HTTP headers.\n\n### Accept\n\n```ts\nimport { Accept } from '@mjackson/headers';\n\nlet header = new Accept('text/html;text/*;q=0.9');\n\nheader.has('text/html'); // true\nheader.has('text/plain'); // false\n\nheader.accepts('text/html'); // true\nheader.accepts('text/plain'); // true\nheader.accepts('text/*'); // true\nheader.accepts('image/jpeg'); // false\n\nheader.getPreferred(['text/html', 'text/plain']); // 'text/html'\n\nfor (let [mediaType, quality] of header) {\n  // ...\n}\n\n// Alternative init styles\nlet header = new Accept({ 'text/html': 1, 'text/*': 0.9 });\nlet header = new Accept(['text/html', ['text/*', 0.9]]);\n```\n\n### Accept-Encoding\n\n```ts\nimport { AcceptEncoding } from '@mjackson/headers';\n\nlet header = new AcceptEncoding('gzip,deflate;q=0.9');\n\nheader.has('gzip'); // true\nheader.has('br'); // false\n\nheader.accepts('gzip'); // true\nheader.accepts('deflate'); // true\nheader.accepts('identity'); // true\nheader.accepts('br'); // true\n\nheader.getPreferred(['gzip', 'deflate']); // 'gzip'\n\nfor (let [encoding, weight] of header) {\n  // ...\n}\n\n// Alternative init styles\nlet header = new AcceptEncoding({ gzip: 1, deflate: 0.9 });\nlet header = new AcceptEncoding(['gzip', ['deflate', 0.9]]);\n```\n\n### Accept-Language\n\n```ts\nimport { AcceptLanguage } from '@mjackson/headers';\n\nlet header = new AcceptLanguage('en-US,en;q=0.9');\n\nheader.has('en-US'); // true\nheader.has('en-GB'); // false\n\nheader.accepts('en-US'); // true\nheader.accepts('en-GB'); // true\nheader.accepts('en'); // true\nheader.accepts('fr'); // true\n\nheader.getPreferred(['en-US', 'en-GB']); // 'en-US'\nheader.getPreferred(['en', 'fr']); // 'en'\n\nfor (let [language, quality] of header) {\n  // ...\n}\n\n// Alternative init styles\nlet header = new AcceptLanguage({ 'en-US': 1, en: 0.9 });\nlet header = new AcceptLanguage(['en-US', ['en', 0.9]]);\n```\n\n### Cache-Control\n\n```ts\nimport { CacheControl } from '@mjackson/headers';\n\nlet header = new CacheControl('public, max-age=3600, s-maxage=3600');\nheader.public; // true\nheader.maxAge; // 3600\nheader.sMaxage; // 3600\n\n// Alternative init style\nlet header = new CacheControl({ public: true, maxAge: 3600 });\n\n// Full set of supported properties\nheader.public; // true/false\nheader.private; // true/false\nheader.noCache; // true/false\nheader.noStore; // true/false\nheader.noTransform; // true/false\nheader.mustRevalidate; // true/false\nheader.proxyRevalidate; // true/false\nheader.maxAge; // number\nheader.sMaxage; // number\nheader.minFresh; // number\nheader.maxStale; // number\nheader.onlyIfCached; // true/false\nheader.immutable; // true/false\nheader.staleWhileRevalidate; // number\nheader.staleIfError; // number\n```\n\n### Content-Disposition\n\n```ts\nimport { ContentDisposition } from '@mjackson/headers';\n\nlet header = new ContentDisposition('attachment; name=file1; filename=file1.txt');\nheader.type; // \"attachment\"\nheader.name; // \"file1\"\nheader.filename; // \"file1.txt\"\nheader.preferredFilename; // \"file1.txt\"\n\n// Alternative init style\nlet header = new ContentDisposition({\n  type: 'attachment',\n  name: 'file1',\n  filename: 'file1.txt',\n});\n```\n\n### Content-Type\n\n```ts\nimport { ContentType } from '@mjackson/headers';\n\nlet header = new ContentType('text/html; charset=utf-8');\nheader.mediaType; // \"text/html\"\nheader.boundary; // undefined\nheader.charset; // \"utf-8\"\n\n// Alternative init style\nlet header = new ContentType({\n  mediaType: 'multipart/form-data',\n  boundary: '------WebKitFormBoundary12345',\n  charset: 'utf-8',\n});\n```\n\n### Cookie\n\n```ts\nimport { Cookie } from '@mjackson/headers';\n\nlet header = new Cookie('theme=dark; session_id=123');\nheader.get('theme'); // \"dark\"\nheader.set('theme', 'light');\nheader.delete('theme');\nheader.has('session_id'); // true\n\n// Iterate over cookie name/value pairs\nfor (let [name, value] of header) {\n  // ...\n}\n\n// Alternative init styles\nlet header = new Cookie({ theme: 'dark', session_id: '123' });\nlet header = new Cookie([\n  ['theme', 'dark'],\n  ['session_id', '123'],\n]);\n```\n\n### If-None-Match\n\n```ts\nimport { IfNoneMatch } from '@mjackson/headers';\n\nlet header = new IfNoneMatch('\"67ab43\", \"54ed21\"');\n\nheader.has('67ab43'); // true\nheader.has('21ba69'); // false\n\nheader.matches('\"67ab43\"'); // true\n\n// Alternative init style\nlet header = new IfNoneMatch(['67ab43', '54ed21']);\nlet header = new IfNoneMatch({\n  tags: ['67ab43', '54ed21'],\n});\n```\n\n### Set-Cookie\n\n```ts\nimport { SetCookie } from '@mjackson/headers';\n\nlet header = new SetCookie('session_id=abc; Domain=example.com; Path=/; Secure; HttpOnly');\nheader.name; // \"session_id\"\nheader.value; // \"abc\"\nheader.domain; // \"example.com\"\nheader.path; // \"/\"\nheader.secure; // true\nheader.httpOnly; // true\nheader.sameSite; // undefined\nheader.maxAge; // undefined\nheader.expires; // undefined\n\n// Alternative init styles\nlet header = new SetCookie({\n  name: 'session_id',\n  value: 'abc',\n  domain: 'example.com',\n  path: '/',\n  secure: true,\n  httpOnly: true,\n});\n```\n\n## Related Packages\n\n- [`fetch-proxy`](https://github.com/mjackson/remix-the-web/tree/main/packages/fetch-proxy) - Build HTTP proxy servers using the web fetch API\n- [`node-fetch-server`](https://github.com/mjackson/remix-the-web/tree/main/packages/node-fetch-server) - Build HTTP servers on Node.js using the web fetch API\n\n## License\n\nSee [LICENSE](https://github.com/mjackson/remix-the-web/blob/main/LICENSE)\n","_attachments":{},"homepage":"https://github.com/mjackson/remix-the-web/tree/main/packages/headers#readme","bugs":{"url":"https://github.com/mjackson/remix-the-web/issues"},"license":"MIT"}