{"id":15767910,"url":"https://github.com/bubkoo/fetch-client","last_synced_at":"2025-09-11T18:49:44.801Z","repository":{"id":57234519,"uuid":"66571207","full_name":"bubkoo/fetch-client","owner":"bubkoo","description":"A convenient fetch client with middleware support.","archived":false,"fork":false,"pushed_at":"2016-09-12T05:53:29.000Z","size":59,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-12T20:48:37.235Z","etag":null,"topics":[],"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/bubkoo.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":"2016-08-25T15:39:49.000Z","updated_at":"2025-04-22T18:19:06.000Z","dependencies_parsed_at":"2022-09-15T00:11:49.731Z","dependency_job_id":null,"html_url":"https://github.com/bubkoo/fetch-client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bubkoo/fetch-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubkoo%2Ffetch-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubkoo%2Ffetch-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubkoo%2Ffetch-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubkoo%2Ffetch-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bubkoo","download_url":"https://codeload.github.com/bubkoo/fetch-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubkoo%2Ffetch-client/sbom","scorecard":{"id":257032,"data":{"date":"2025-08-11","repo":{"name":"github.com/bubkoo/fetch-client","commit":"b30a77fd993041c16fd056650c9938539d10910b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}}]},"last_synced_at":"2025-08-17T09:55:56.353Z","repository_id":57234519,"created_at":"2025-08-17T09:55:56.353Z","updated_at":"2025-08-17T09:55:56.353Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274689951,"owners_count":25331897,"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-09-11T02:00:13.660Z","response_time":74,"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":[],"created_at":"2024-10-04T13:41:45.541Z","updated_at":"2025-09-11T18:49:44.770Z","avatar_url":"https://github.com/bubkoo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![fetch-client](https://cdn.rawgit.com/bubkoo/fetch-client/aa46997/logo.svg)\n\n\u003e A convenient fetch client with middleware support.\n\n[![MIT License](https://img.shields.io/badge/license-MIT_License-green.svg?style=flat-square)](https://github.com/bubkoo/fetch-client/blob/master/LICENSE)\n\n[![build:?](https://img.shields.io/travis/bubkoo/fetch-client/master.svg?style=flat-square)](https://travis-ci.org/bubkoo/fetch-client)\n[![coverage:?](https://img.shields.io/coveralls/bubkoo/fetch-client/master.svg?style=flat-square)](https://coveralls.io/github/bubkoo/fetch-client)\n[![Package Quality](http://npm.packagequality.com/shield/fetch-client.svg)](http://packagequality.com/#?package=fetch-client)\n\n\n## Features\n\nYou can do all the same thing that you do with fetch, plus:\n\n- Custom middlewares to intercept requests, responses, and caught errors.\n- Useful middlewares available as separate npm packages.\n- Create custom config instances.\n- Convenient aliases for the supported methods.\n- Runs in Node and all browsers(with polyfill).\n\n## Installation\n\n```\n$ npm install --save fetch-client\n```\n\n## Usage\n\n*Note:* Make sure you have a fetch [compatible environment](http://caniuse.com/#search=fetch) or added a appropriate [polyfill](https://github.com/matthew-andrews/isomorphic-fetch).\n\n\nPerforming a `GET` request\n\n```js\nimport FetchClient from 'fetch-client';\n\nlet fetchClient = new FetchClient();\nfetchClient.get('http://httpbin.org/get?param1=param1')\n  .then((response) =\u003e response.json())\n  .then((json) =\u003e console.log(json))\n  .catch((error) =\u003e console.error(error));\n```\n\nPerforming a `POST` request\n\n```js\n\nimport FetchClient from 'fetch-client';\n\nlet fetchClient = new FetchClient();\nfetchClient.post('http://httpbin.org/post?param1=param1', {\n  param2: 'param2',\n  param3: 'param3'\n}).then((response) =\u003e response.json())\n  .then((json) =\u003e console.log(json))\n  .catch((error) =\u003e console.error(error));\n```\n\n## API\n\n### Create custom config instance\n\nYou can create a new instance of FetchClient with a custom config.\n\n```js\nlet fetchClient = new FetchClient({\n  headers: {\n    'X-Custom-Header': 'foobar'\n  }\n});\n\nfetchClient.get(url)\n  .then((response) =\u003e {\n    // handle response\n  })\n  .catch((error) =\u003e {\n    // handle error\n  });\n```\n\n### Request method aliases\n\nFor convenience aliases have been provided for all supported request methods.\n\n- fetchClient.fetch(url[, options])\n- fetchClient.fetch(request[, options])\n- fetchClient.get(url[, options])\n- fetchClient.get(request[, options])\n- fetchClient.head(url[, options])\n- fetchClient.head(request[, options])\n- fetchClient.delete(url[, options])\n- fetchClient.delete(request[, options])\n- fetchClient.put(url[, data[, options]])\n- fetchClient.put(request[, data[, options]])\n- fetchClient.post(url[, data[, options]])\n- fetchClient.post(request[, data[, options]])\n- fetchClient.patch(url[, data[, options]])\n- fetchClient.patch(request[, data[, options]])\n\n*NOTE:* When using the alias methods `url`, `method`, and `data` properties don't need to be specified in options.\n\n\n## Middleware\n\nYou can add middleware objects to any instance, to intercept requests and responses.\n\nThe middleware object must have defined at least one of these methods:\n\n- `request(req)` takes the [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) that will be passed to `global.fetch()` after interceptors run. It should return the same Request, or create a new one. Errors thrown in request interceptors will be handled by `requestError` interceptors.\n- `requestError(error)` acts as a Promise rejection handler during Request creation and request interceptor execution. It will receive the rejection reason, and can either re-throw, or recover by returning a valid Request.\n- `response(res)` will be run after `fetch()`` completes, and will receive the resulting [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response). As with request, it can either pass the Response along, return a modified response, or throw.\n- `responseError(error)` is similar to `requestError`, and acts as a Promise rejection handler for response rejections.\n\n```js\nlet jsonMiddleware = {\n  response(res) {\n    return res.json().catch((e) =\u003e {\n      return e;\n    });\n  }\n};\n\n// fetchClient.addMiddlewares(ArrayOrMiddlewares)\nfetchClient.addMiddlewares(jsonMiddleware);\n\n// clear\nfetchClient.clearMiddlewares();\n```\n\n### Interceptors' running sequence\n\n```js\nimport FetchClient from 'fetch-client';\n\nlet fetchClient = new FetchClient();\nlet middleware1 = {\n  request(req) {\n    req.headers.set('x-req-fake1', true);\n    return req;\n  },\n\n  requestError(error) {\n    return global.Promise.reject(error);\n  },\n\n  response(res) {\n    res.headers.set('x-res-fake1', true);\n    return res;\n  },\n\n  responseError(error) {\n    return global.Promise.reject(error);\n  }\n};\nlet middleware2 = {\n  request(req) {\n    req.headers.set('x-req-fake2', true);\n    return req;\n  },\n\n  requestError(error) {\n    return global.Promise.reject(error);\n  },\n\n  response(res) {\n    res.headers.set('x-res-fake2', true);\n    return res;\n  },\n\n  responseError(error) {\n    return global.Promise.reject(error);\n  }\n};\n\nfetchClient.addMiddlewares([middleware1, middleware2]);\nfetchClient.fetch('http://example.com/page');\n\n\n// the interceptors will be executed with the following sequence, equal with:\nlet req = new Request('http://example.com/page');\nlet promise = Promise.resolve(req);\n\npromise\n  // handle request\n  .then(middleware1.request)\n  .then(null, middleware1.requestError)\n  .then(middleware2.request)\n  .then(null, middleware2.requestError)\n  // call the fetch method\n  .then(global.fetch)\n  // handle response\n  .then(middleware1.response)\n  .then(null, middleware1.responseError)\n  .then(middleware2.response)\n  .then(null, middleware2.responseError);\n```\n\n### Additional middlewares\n\n- npm install --save fetch-client-json\n- npm install --save fetch-client-xml\n- npm install --save fetch-client-useragent\n\n\n## Contributing\n\nPull requests and stars are highly welcome.\n\nFor bugs and feature requests, please [create an issue](https://github.com/bubkoo/fetch-client/issues/new).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbubkoo%2Ffetch-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbubkoo%2Ffetch-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbubkoo%2Ffetch-client/lists"}