{"id":18535285,"url":"https://github.com/tinyhttp/vary","last_synced_at":"2025-10-08T21:15:02.343Z","repository":{"id":50095428,"uuid":"279382950","full_name":"tinyhttp/vary","owner":"tinyhttp","description":"vary rewrite in TypeScript for ESM","archived":false,"fork":false,"pushed_at":"2024-07-18T18:02:00.000Z","size":121,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-30T15:42:02.589Z","etag":null,"topics":["esm","http","nodejs","typescript","vary"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tinyhttp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"ko_fi":"v1rtl","liberapay":"v1rtl","issuehunt":"talentlessguy"}},"created_at":"2020-07-13T18:35:03.000Z","updated_at":"2025-08-27T13:22:17.000Z","dependencies_parsed_at":"2024-08-26T04:02:43.650Z","dependency_job_id":"453df17b-c1a8-45ff-9cc6-2720a5ccacc6","html_url":"https://github.com/tinyhttp/vary","commit_stats":{"total_commits":25,"total_committers":4,"mean_commits":6.25,"dds":0.56,"last_synced_commit":"619fb89528f1519035dd4dabc70e79d97d1f7aec"},"previous_names":["tinyhttp/vary","talentlessguy/es-vary"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/tinyhttp/vary","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyhttp%2Fvary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyhttp%2Fvary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyhttp%2Fvary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyhttp%2Fvary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tinyhttp","download_url":"https://codeload.github.com/tinyhttp/vary/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyhttp%2Fvary/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000710,"owners_count":26082837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["esm","http","nodejs","typescript","vary"],"created_at":"2024-11-06T19:21:46.451Z","updated_at":"2025-10-08T21:15:02.287Z","avatar_url":"https://github.com/tinyhttp.png","language":"TypeScript","readme":"# @tinyhttp/vary\n\n[![Version][v-badge-url]][npm-url] [![Downloads][dl-badge-url]][npm-url] [![GitHub Workflow Status][gh-actions-img]][github-actions] [![Codecov][cov-badge-url]][cov-url]\n\n\u003e [`vary`](https://github.com/jshttp/vary) rewrite in TypeScript with ESM and CommonJS targets\n\nManipulate the HTTP Vary header\n\n## Install\n\n```sh\npnpm i @tinyhttp/vary\n```\n\n## API\n\n```ts\nimport { vary, append } from '@tinyhttp/vary'\n```\n\n### `vary(res, field)`\n\nAdds the given header `field` to the `Vary` response header of `res`.\nThis can be a string of a single field, a string of a valid `Vary`\nheader, or an array of multiple fields.\n\nThis will append the header if not already listed, otherwise leaves\nit listed in the current location.\n\n```ts\nvary(res, 'Origin')\n```\n\n### `append(header, field)`\n\nAdds the given header `field` to the `Vary` response header string `header`.\nThis can be a string of a single field, a string of a valid `Vary` header,\nor an array of multiple fields.\n\nThis will append the header if not already listed, otherwise leaves\nit listed in the current location. The new header string is returned.\n\n```ts\n// Get header string appending \"Origin\" to \"Accept, User-Agent\"\nappend('Accept, User-Agent', 'Origin')\n```\n\n## Examples\n\n```ts\nimport { createServer } from 'node:http'\nimport { vary } from '@tinyhttp/vary'\n\ncreateServer((req, res) =\u003e {\n  // about to user-agent sniff\n  vary(res, 'User-Agent')\n\n  const ua = req.headers['user-agent'] || ''\n  const isMobile = /mobi|android|touch|mini/i.test(ua)\n\n  // serve site, depending on isMobile\n  res.setHeader('Content-Type', 'text/html')\n  res.end('You are (probably) ' + (isMobile ? '' : 'not ') + 'a mobile user')\n})\n```\n\n## License\n\nMIT © [v1rtl](https://v1rtl.site)\n\n[v-badge-url]: https://img.shields.io/npm/v/@tinyhttp/vary.svg?style=for-the-badge\u0026color=FF69B4\u0026label=\u0026logo=npm\n[npm-url]: https://www.npmjs.com/package/@tinyhttp/vary\n[cov-badge-url]: https://img.shields.io/coveralls/github/tinyhttp/vary?style=for-the-badge\u0026color=FF69B4\n[cov-url]: https://coveralls.io/github/tinyhttp/vary\n[dl-badge-url]: https://img.shields.io/npm/dt/@tinyhttp/vary?style=for-the-badge\u0026color=FF69B4\n[github-actions]: https://github.com/tinyhttp/vary/actions\n[gh-actions-img]: https://img.shields.io/github/actions/workflow/status/tinyhttp/vary/main.yml?branch=master\u0026style=for-the-badge\u0026color=FF69B4\u0026label=\u0026logo=github\n","funding_links":["https://ko-fi.com/v1rtl","https://liberapay.com/v1rtl","https://issuehunt.io/r/talentlessguy"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinyhttp%2Fvary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftinyhttp%2Fvary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinyhttp%2Fvary/lists"}