{"id":19339710,"url":"https://github.com/rubenv/connect-body-rewrite","last_synced_at":"2025-06-17T08:40:13.536Z","repository":{"id":57205689,"uuid":"14396694","full_name":"rubenv/connect-body-rewrite","owner":"rubenv","description":"Rewrite request bodies.","archived":false,"fork":false,"pushed_at":"2014-07-03T06:29:47.000Z","size":210,"stargazers_count":16,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-25T13:54:21.332Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/rubenv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-14T14:07:53.000Z","updated_at":"2018-10-04T09:53:30.000Z","dependencies_parsed_at":"2022-09-18T01:32:25.438Z","dependency_job_id":null,"html_url":"https://github.com/rubenv/connect-body-rewrite","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/rubenv/connect-body-rewrite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubenv%2Fconnect-body-rewrite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubenv%2Fconnect-body-rewrite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubenv%2Fconnect-body-rewrite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubenv%2Fconnect-body-rewrite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rubenv","download_url":"https://codeload.github.com/rubenv/connect-body-rewrite/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubenv%2Fconnect-body-rewrite/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260324836,"owners_count":22992259,"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","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":[],"created_at":"2024-11-10T03:23:28.450Z","updated_at":"2025-06-17T08:40:13.505Z","avatar_url":"https://github.com/rubenv.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# connect-body-rewrite - middleware to rewrite response bodies.\n\n\u003e Rewrite response bodies for some requests.\n\n[![Build Status](https://travis-ci.org/rubenv/connect-body-rewrite.png?branch=master)](https://travis-ci.org/rubenv/connect-body-rewrite)\n\nThis plugin allows you to write middleware methods that process the response\nbody of a call.\n\n## Usage\n\nAdd the module:\n\n```bash\nnpm install connect-body-rewrite --save\n```\n\nSpecify an accept function and a rewrite function:\n\n\n```javascript\napp.use(require('connect-body-rewrite')({\n    accept: function (res) {\n        return res.getHeader('content-type').match(/text\\/html/);\n    },\n    rewrite: function (body) {\n        return body.replace(/\u003c\\/body\u003e/, \"Copyright 2013 \u003c/body\u003e\");\n    }\n}));\n```\n\nThe `accept` function should return a boolean to indicate whether or not this\nrequest should be processed.\n\nUsed in:\n\n* [connect-strip-manifest](https://github.com/rubenv/connect-strip-manifest)\n* [connect-livereload-safe](https://github.com/rubenv/connect-livereload-safe)\n\n## License \n\n    (The MIT License)\n\n    Copyright (C) 2013 by Ruben Vermeersch \u003cruben@savanne.be\u003e\n\n    Permission is hereby granted, free of charge, to any person obtaining a copy\n    of this software and associated documentation files (the \"Software\"), to deal\n    in the Software without restriction, including without limitation the rights\n    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n    copies of the Software, and to permit persons to whom the Software is\n    furnished to do so, subject to the following conditions:\n\n    The above copyright notice and this permission notice shall be included in\n    all copies or substantial portions of the Software.\n\n    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n    THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubenv%2Fconnect-body-rewrite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubenv%2Fconnect-body-rewrite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubenv%2Fconnect-body-rewrite/lists"}