{"id":15975808,"url":"https://github.com/pdmlab/express-http-warning","last_synced_at":"2026-02-10T16:31:20.671Z","repository":{"id":40276896,"uuid":"251241035","full_name":"PDMLab/express-http-warning","owner":"PDMLab","description":"Create warnings following RFC draft-cedik-http-warning-02: https://tools.ietf.org/html/draft-cedik-http-warning-02","archived":false,"fork":false,"pushed_at":"2023-07-19T09:31:04.000Z","size":538,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-09T05:54:49.206Z","etag":null,"topics":["expressjs","hateoas","http","hypermedia","nodejs","rest-api","rfc","warning","warnings"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/express-http-warning","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/PDMLab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"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}},"created_at":"2020-03-30T08:09:32.000Z","updated_at":"2022-12-14T23:14:36.000Z","dependencies_parsed_at":"2024-10-23T14:07:13.192Z","dependency_job_id":null,"html_url":"https://github.com/PDMLab/express-http-warning","commit_stats":{"total_commits":36,"total_committers":2,"mean_commits":18.0,"dds":"0.38888888888888884","last_synced_commit":"2172fb3f0e56015cda789e7fe805de28261e2587"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/PDMLab/express-http-warning","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PDMLab%2Fexpress-http-warning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PDMLab%2Fexpress-http-warning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PDMLab%2Fexpress-http-warning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PDMLab%2Fexpress-http-warning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PDMLab","download_url":"https://codeload.github.com/PDMLab/express-http-warning/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PDMLab%2Fexpress-http-warning/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270149345,"owners_count":24535728,"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-08-12T02:00:09.011Z","response_time":80,"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":["expressjs","hateoas","http","hypermedia","nodejs","rest-api","rfc","warning","warnings"],"created_at":"2024-10-07T22:05:13.615Z","updated_at":"2026-02-10T16:31:20.635Z","avatar_url":"https://github.com/PDMLab.png","language":"TypeScript","readme":"[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) [![Join the chat at https://gitter.im/pdmlab/community](https://badges.gitter.im/pdmlab/community.svg)](https://gitter.im/pdmlab/community)\n\n# express-http-warning\n\nCreate warnings for HTTP responses in express following RFC [draft-cedik-http-warning-01](https://tools.ietf.org/html/draft-cedik-http-warning-01)\n\n## Usage\n\nYou can create warnings using the `.warn` function on the Response object like this:\n\n```typescript\nimport express, { Request, Response } from 'express'\nimport { ProblemDocument } from 'http-problem-details'\nimport registerwarnings from 'express-http-warning/'\n\nconst app = express()\napp.use(registerwarnings())\napp.get('/', (_req: Request, res: Response) =\u003e {\n  return res\n    .status(200)\n    .warn([\n      new ProblemDocument({\n        detail: 'Street name was too long. It has been shortened...',\n        instance: 'https://example.com/shipments/3a186c51/msgs/c94d',\n        type: 'https://example.com/errors/shortened_entry'\n      })\n    ])\n    .send({ some: 'content' })\n})\nconst server = app.listen(3000)\nprocess.on('SIGINT', () =\u003e {\n  server.close()\n})\n```\n\nWhen calling http://localhost:3000/, your output should look like this:\n\n```bash\n$ http get http://localhost:3000/\n\nHTTP/1.1 200 OK\nConnection: keep-alive\nContent-Length: 209\nContent-Type: application/json; charset=utf-8\nContent-Warning: \"embedded-warning\"; 1601818734551\nDate: Sun, 04 Oct 2020 13:38:54 GMT\nETag: W/\"d1-CjE3r0SHoZBMEN5aorcGVXlp0ac\"\nKeep-Alive: timeout=5\nX-Powered-By: Express\n\n{\n    \"some\": \"content\",\n    \"warnings\": [\n        {\n            \"detail\": \"Street name was too long. It has been shortened...\",\n            \"instance\": \"https://example.com/shipments/3a186c51/msgs/c94d\",\n            \"type\": \"https://example.com/errors/shortened_entry\"\n        }\n    ]\n}\n```\n\nAs you can see, the `warnings` member has been added to the JSON body. Also the `Content-Warning` header has been added.\n\n## Want to help?\n\nThis project is just getting off the ground and could use some help with cleaning things up and refactoring.\n\nIf you want to contribute - we'd love it! Just open an issue to work against so you get full credit for your fork. You can open the issue first so we can discuss and you can work your fork as we go along.\n\nIf you see a bug, please be so kind as to show how it's failing, and we'll do our best to get it fixed quickly.\n\nBefore sending a PR, please [create an issue](issues/new) to introduce your idea and have a reference for your PR.\n\nWe're using [conventional commits](https://www.conventionalcommits.org), so please use it for your commits as well.\n\nAlso please add tests and make sure to run `npm run lint-ts` or `yarn lint-ts`.\n\n## License\n\nMIT License\n\nCopyright (c) 2020 PDMLab\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdmlab%2Fexpress-http-warning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpdmlab%2Fexpress-http-warning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdmlab%2Fexpress-http-warning/lists"}