{"id":16588099,"url":"https://github.com/mlegenhausen/fetch-intercept","last_synced_at":"2025-04-05T17:07:45.060Z","repository":{"id":37574551,"uuid":"44531060","full_name":"mlegenhausen/fetch-intercept","owner":"mlegenhausen","description":"Interceptor library for the native fetch command inspired by angular http intercepts.","archived":false,"fork":false,"pushed_at":"2022-12-08T15:48:15.000Z","size":1087,"stargazers_count":395,"open_issues_count":38,"forks_count":49,"subscribers_count":12,"default_branch":"develop","last_synced_at":"2024-05-23T07:47:27.357Z","etag":null,"topics":["fetch","intercept","interceptor"],"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/mlegenhausen.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}},"created_at":"2015-10-19T11:49:30.000Z","updated_at":"2024-05-18T00:06:30.000Z","dependencies_parsed_at":"2023-01-25T18:01:41.659Z","dependency_job_id":null,"html_url":"https://github.com/mlegenhausen/fetch-intercept","commit_stats":null,"previous_names":["werk85/fetch-intercept"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlegenhausen%2Ffetch-intercept","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlegenhausen%2Ffetch-intercept/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlegenhausen%2Ffetch-intercept/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlegenhausen%2Ffetch-intercept/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mlegenhausen","download_url":"https://codeload.github.com/mlegenhausen/fetch-intercept/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305310,"owners_count":20917195,"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":["fetch","intercept","interceptor"],"created_at":"2024-10-11T22:55:51.464Z","updated_at":"2025-04-05T17:07:45.038Z","avatar_url":"https://github.com/mlegenhausen.png","language":"JavaScript","readme":"# fetch-intercept\n\n[![Build Status](https://travis-ci.org/werk85/fetch-intercept.svg?branch=master)](https://travis-ci.org/werk85/fetch-intercept)\n\nInterceptor library for the native fetch command inspired by [angular http interceptors](https://docs.angularjs.org/api/ng/service/$http).\n\n`fetch-intercept` monkey patches the global `fetch` method and allows you the usage in Browser, Node and Webworker environments.\n\n## Installation\n\n```\nnpm install fetch-intercept --save\n```\n\n## Usage\n\n_Note_: You need to require `fetch-intercept` before you use `fetch` the first time.\n\nMake sure you have a `fetch` [compatible environment](http://caniuse.com/#search=fetch) or added a [appropriate polyfill](https://github.com/github/fetch).\n\n```js\nimport fetchIntercept from 'fetch-intercept';\n\nconst unregister = fetchIntercept.register({\n    request: function (url, config) {\n        // Modify the url or config here\n        return [url, config];\n    },\n\n    requestError: function (error) {\n        // Called when an error occured during another 'request' interceptor call\n        return Promise.reject(error);\n    },\n\n    response: function (response) {\n        // Modify the reponse object\n        return response;\n    },\n\n    responseError: function (error) {\n        // Handle an fetch error\n        return Promise.reject(error);\n    }\n});\n\n// Call fetch to see your interceptors in action.\nfetch('http://google.com');\n\n// Unregister your interceptor\nunregister();\n```\n\n## React-Native Compatibility\nSupport react-native `0.17` or higher versions.\n\n## License\nMIT","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlegenhausen%2Ffetch-intercept","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmlegenhausen%2Ffetch-intercept","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlegenhausen%2Ffetch-intercept/lists"}