{"id":17688452,"url":"https://github.com/wflixu/obfetch","last_synced_at":"2025-06-29T10:37:32.350Z","repository":{"id":66991100,"uuid":"604068682","full_name":"wflixu/obfetch","owner":"wflixu","description":"a httpClient base on rxjs and fetch api inspired by angular httpClient","archived":false,"fork":false,"pushed_at":"2024-03-06T05:08:34.000Z","size":340,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-01T15:28:51.204Z","etag":null,"topics":["axios","fetch","fetch-api","http","http-client","rxjs"],"latest_commit_sha":null,"homepage":"","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/wflixu.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-20T09:13:16.000Z","updated_at":"2025-02-11T00:34:09.000Z","dependencies_parsed_at":"2023-12-02T05:28:16.502Z","dependency_job_id":"34614752-fb51-40e8-bc63-fc3d4352c111","html_url":"https://github.com/wflixu/obfetch","commit_stats":null,"previous_names":["wflixu/rfetch"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/wflixu/obfetch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wflixu%2Fobfetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wflixu%2Fobfetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wflixu%2Fobfetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wflixu%2Fobfetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wflixu","download_url":"https://codeload.github.com/wflixu/obfetch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wflixu%2Fobfetch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259418215,"owners_count":22854187,"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":["axios","fetch","fetch-api","http","http-client","rxjs"],"created_at":"2024-10-24T11:44:28.484Z","updated_at":"2025-06-29T10:37:32.327Z","avatar_url":"https://github.com/wflixu.png","language":"TypeScript","funding_links":[],"categories":["Angular-Inspired Solutions"],"sub_categories":["Wrappers"],"readme":"# obfetch\nAn http client based on rxjs and fetch API inspired by Angular HttpClient.\n\n# use\n\n## install\n\n```shell\n#npm\nnpm install obfetch\n\n#pnpm\nnpm add obfetch\n\n```\n## example \n\n### basic\n\n\n```\n// http.ts/js\nimport  { HttpClient } from 'obfetch';\nepxort  const http = new HttpClient({\n  baseURL:'http://somehost:8888/some/path'\n});\n\n// business.ts\nimport {http} from 'http'\n\nhttp.get('http://127.0.0.1:8443/ping').subscribe(data =\u003e {\n    console.log(data);\n})\nhttp.post('http://127.0.0.1:8443/ping', {username:'youname'}).subscribe(data =\u003e {\n    console.log(data);\n})\n\n```\n\n\n### Interceptors\n\nobfetch supports a form of middleware known as interceptors, you can use interceptor config request or format response data。\n\n\n```\n// Defining an interceptor modifying request\nexport function tokenInterceptor(req: HttpRequest\u003cunknown\u003e, next: HttpHandlerFn): Observable\u003cHttpEvent\u003cunknown\u003e\u003e {\n  let token = getTokenSomeWhere();\n  if(token) {\n     const reqWithHeader = req.clone({\n          headers: req.headers.set('Authorizen', token),\n     });\n     return next(reqWithHeader);\n  }\n \n  return next(req);\n}\n\n// Defining an interceptor formatting response data\n\nexport function responseDataFormatInterceptor(req: HttpRequest\u003cunknown\u003e, next: HttpHandlerFn): Observable\u003cHttpEvent\u003cunknown\u003e\u003e {\n  return next(req).pipe(\n      map((event: HttpEvent\u003cany\u003e) =\u003e {\n        if (event instanceof HttpResponse) {\n           return event.clone({ body: event.body?.data });\n        }\n         return event;\n      }),\n    );\n}\n\n// Use interceptor\nhttp.use([tokenInterceptor,responseDataFormatInterceptor])\n\n//\n\n```\n\n\n# Developing \n\n## local build\n\n```\npnpm install\n\npnpm build\n\n```\n\n## unit test\n\n```\npnpm vitest run\n\npnpm coerage\n```\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwflixu%2Fobfetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwflixu%2Fobfetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwflixu%2Fobfetch/lists"}