{"id":21602265,"url":"https://github.com/b-goodman/http-client","last_synced_at":"2025-10-04T06:46:37.305Z","repository":{"id":46916895,"uuid":"219667690","full_name":"b-goodman/http-client","owner":"b-goodman","description":"An async HTTP Client implementing Window.XMLHttpRequest.","archived":false,"fork":false,"pushed_at":"2023-01-05T00:09:30.000Z","size":921,"stargazers_count":0,"open_issues_count":12,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-24T18:35:05.996Z","etag":null,"topics":["xmlhttprequest-wrapper"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/b-goodman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-05T05:50:58.000Z","updated_at":"2020-03-24T12:42:07.000Z","dependencies_parsed_at":"2023-02-03T01:15:55.283Z","dependency_job_id":null,"html_url":"https://github.com/b-goodman/http-client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b-goodman%2Fhttp-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b-goodman%2Fhttp-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b-goodman%2Fhttp-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b-goodman%2Fhttp-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/b-goodman","download_url":"https://codeload.github.com/b-goodman/http-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244228305,"owners_count":20419390,"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":["xmlhttprequest-wrapper"],"created_at":"2024-11-24T19:12:39.694Z","updated_at":"2025-10-04T06:46:32.246Z","avatar_url":"https://github.com/b-goodman.png","language":"TypeScript","readme":"# HTTPClient\n\nAn async HTTP Client implementing `Window.XMLHttpRequest`.\nIntended to imitate the `Window.fetch` API but still offering full backards compatability with legacy browsers.\n\n## Installation\n\n```bash\nnpm install @bgoodman/http-client\n\nyarn add @bgoodman/http-client\n```\n\n## Usage\n\n```typescript\nimport {HTTPClient} from \"@bgoodman/http-client\"\n\ninterface CurrencyConversion {\n    rates: {[currency: string]: number};\n    base: string;\n    date: string;\n}\n\nconst endpointUrl = \"https://api.exchangeratesapi.io/latest?symbols=USD,GBP\";\n\nconst req = await HTTPClient.get(endpointUrl);\nconst data = HTTPClient.json\u003cCurrencyConversion\u003e(req);\n\nconsole.log(data)\n//{\"rates\":{\"USD\":1.1158,\"GBP\":0.86368},\"base\":\"EUR\",\"date\":\"2019-11-04\"\n```\n\n### API\n\n#### `get`\n\nPerform a HTTP `get` request.\n\n```typescript\nHTTPClient.get(url: string, opts?: HTTPClient.Opts): Promise\u003cXMLHttpRequest\u003e\n```\n\n#### `json`\n\nConveniently parse the response from an earlier request expected to resolve to JSON data.\n\n```typescript\nHTTPClient.json\u003cT = any\u003e(req: XMLHttpRequest): T;\n```\n\n#### `post`\n\nPerform a HTTP `post` request.\n\n```typescript\nHTTPClient.post(url: string, data: FormData, opts?: HTTPClient.Opts): Promise\u003cXMLHttpRequest\u003e\n```\n\n#### `delete`\n\nPerform a HTTP `delete` request.\n\n```typescript\nHTTPClient.delete(url: string, data: FormData, opts?: HTTPClient.Opts): Promise\u003cXMLHttpRequest\u003e\n```\n\n---\n\n#### Options\n\n```typescript\nwithCredentials?: boolean;\nresponseType?: XMLHttpRequestResponseType;\nrequestHeaders?: Map\u003cstring, string\u003e;\ntimeout?: number;\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb-goodman%2Fhttp-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fb-goodman%2Fhttp-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb-goodman%2Fhttp-client/lists"}