{"id":20990228,"url":"https://github.com/shanamaid/xhr-proxy-plus","last_synced_at":"2025-12-29T23:13:30.809Z","repository":{"id":57401406,"uuid":"288984234","full_name":"ShanaMaid/xhr-proxy-plus","owner":"ShanaMaid","description":"help proxy xhr,  the same as axios interceptor","archived":false,"fork":false,"pushed_at":"2021-08-18T03:45:33.000Z","size":42,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-23T22:40:33.875Z","etag":null,"topics":["http-record","interceptor","xhr","xhr-interceptor","xhr-proxy","xmlhttprequest"],"latest_commit_sha":null,"homepage":"","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/ShanaMaid.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":"2020-08-20T11:09:35.000Z","updated_at":"2024-04-13T08:52:38.000Z","dependencies_parsed_at":"2022-09-19T04:51:37.320Z","dependency_job_id":null,"html_url":"https://github.com/ShanaMaid/xhr-proxy-plus","commit_stats":null,"previous_names":["shanamaid/xhr-proxy"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShanaMaid%2Fxhr-proxy-plus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShanaMaid%2Fxhr-proxy-plus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShanaMaid%2Fxhr-proxy-plus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShanaMaid%2Fxhr-proxy-plus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ShanaMaid","download_url":"https://codeload.github.com/ShanaMaid/xhr-proxy-plus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243401492,"owners_count":20285052,"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":["http-record","interceptor","xhr","xhr-interceptor","xhr-proxy","xmlhttprequest"],"created_at":"2024-11-19T06:27:59.558Z","updated_at":"2025-12-29T23:13:30.768Z","avatar_url":"https://github.com/ShanaMaid.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align='center'\u003exhr-proxy-plus\u003c/h1\u003e\n\u003cp align='center'\u003e\n  \u003cimg src='https://img.shields.io/npm/v/xhr-proxy-plus.svg?style=flat-square' alt=\"version\"\u003e\n  \u003cimg src='https://img.shields.io/npm/l/xhr-proxy-plus.svg' alt=\"license\"\u003e\n  \u003cimg src='http://img.badgesize.io/https://unpkg.com/xhr-proxy-plus/build/index.js?compression=gzip\u0026label=gzip%20size:%20\u0026style=flat-square'\u003e\n  \u003cimg src='https://img.shields.io/npm/dt/xhr-proxy-plus.svg?style=flat-square' alt=\"downloads\"\u003e\n  \u003cimg src='https://img.shields.io/npm/dm/xhr-proxy-plus.svg?style=flat-square' alt=\"downloads-month\"\u003e\n\u003c/p\u003e\n\n## Install\n```\nnpm install xhr-proxy-plus\n```\n\n## How to use ?\n```js\nimport { XhrProxy } from 'xhr-proxy-plus';\n//  start proxy xhr\nconst handle = new XhrProxy({\n  beforeHooks: {\n    open: (...p) =\u003e {\n      console.log('xhr.open params', ...p);\n    },\n    send: (...p) =\u003e {\n      console.log('xhr.send params', ...p);\n      console.log('xhr.send will stop  executing');\n        // hook return false will stop xhr\n      return false;\n    }\n  },\n  afterHooks: {},\n  apiCallback: (r) =\u003e {\n    console.log('request message---\u003e', r);\n  }\n});\n\n// cancel proxy\nhandle.unset();\n```\n\nconsole.log\n```js \nxhr.open params GET /api/v1/query/goods true\nxhr.send params {\"name\":\"\"}\n\nrequest message---\u003e\n {\n  \"method\": \"GET\",\n  \"url\": \"/api/v1/query/goods\",\n  \"params\": {\n    name: 'water',\n  },\n  \"requestHeaders\": {\n    \"Accept\": \"application/json, text/plain, */*\",\n  },\n  \"body\": null,\n  \"requestStamp\": 1597922785160,\n  \"responseData\": {\n    \"code\": 0,\n    \"message\": \"ok\",\n    \"data\": null\n  },\n  \"responsHeaders\": {\n    \"content-type\": \"application/json; charset=UTF-8\",\n    \"date\": \"Thu, 20 Aug 2020 11:26:25 GMT\",\n  },\n  \"responsStamp\": 1597922785301\n}\n\n```\n\n## Thanks\n[hiNISAL](https://github.com/hiNISAL/any-xhr)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshanamaid%2Fxhr-proxy-plus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshanamaid%2Fxhr-proxy-plus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshanamaid%2Fxhr-proxy-plus/lists"}