{"id":16123001,"url":"https://github.com/ariesclark/http","last_synced_at":"2025-04-06T11:50:01.459Z","repository":{"id":54194518,"uuid":"334094259","full_name":"ariesclark/http","owner":"ariesclark","description":"Simple, small and extendable http library for sending requests.","archived":false,"fork":false,"pushed_at":"2021-04-01T20:27:11.000Z","size":82,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-13T16:33:33.025Z","etag":null,"topics":["api","http","library","rest"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ariesclark.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":"2021-01-29T09:18:57.000Z","updated_at":"2021-04-01T20:27:13.000Z","dependencies_parsed_at":"2022-08-13T08:50:57.063Z","dependency_job_id":null,"html_url":"https://github.com/ariesclark/http","commit_stats":null,"previous_names":["rubybb/http"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariesclark%2Fhttp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariesclark%2Fhttp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariesclark%2Fhttp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariesclark%2Fhttp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ariesclark","download_url":"https://codeload.github.com/ariesclark/http/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247478286,"owners_count":20945265,"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":["api","http","library","rest"],"created_at":"2024-10-09T21:14:16.347Z","updated_at":"2025-04-06T11:50:01.429Z","avatar_url":"https://github.com/ariesclark.png","language":"TypeScript","readme":"# @rubybb/http\nSimple, small and extendable http library for sending requests.\n\n[![Discord](https://img.shields.io/discord/418093857394262020?label=discord\u0026style=for-the-badge)](https://discord.gg/WUgGJhS) [![Maintenance](https://img.shields.io/maintenance/yes/2021?style=for-the-badge)]() ![GitHub issues](https://img.shields.io/github/issues/rubybb/http?style=for-the-badge) ![npm bundle size (scoped)](https://img.shields.io/bundlephobia/min/@rubybb/http?style=for-the-badge) ![NPM](https://img.shields.io/npm/l/@rubybb/http?style=for-the-badge)\n\n## Install\nAvailable on NPM: [@rubybb/http](https://www.npmjs.com/package/@rubybb/http)\n\nRuby's recommended package manager: \u003cbr/\u003e\n[pnpm: 📦🚀 Fast, disk space efficient package manager](https://pnpm.js.org/).\n\n```\npnpm install @rubybb/http\n```\n\n## Examples\n```ts\nimport http, { HTTP } from \"@rubybb/http\";\n\nhttp.get(\"https://reqres.in/api/users/3\", {resultType: \"json\"}).then((json) =\u003e {\n    console.log(json);\n    /* {\n        data: {\n            id: 3,\n            email: \"emma.wong@reqres.in\",\n            first_name: \"Emma\",\n            last_name: \"Wong\",\n            avatar: \"https://reqres.in/img/faces/3-image.jpg\"\n        }\n    } */\n});\n\nconst api = HTTP.create({\n    baseURL: \"https://reqres.in/api/\",\n    resultType: \"json\"\n});\n\napi.get(\"users/3\").then((json) =\u003e {...});\napi.get(\"users/:id\", {id: 3}).then((json) =\u003e {...});\n```\n\n## API\n\n**NOTE**: RequestInit refers to all [native fetch options](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request), and BodyInit refers to a [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob), [BufferSource](https://developer.mozilla.org/en-US/docs/Web/API/BufferSource), [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData), [URLSearchParams](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams), [USVString](https://developer.mozilla.org/en-US/docs/Web/API/USVString), or [ReadableStream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) object.\n\n```ts\nexport declare interface HTTPOptions extends RequestInit {\n    resultType: ResultType;\n    query: Record\u003cstring, any\u003e;\n    excludeDefaults: boolean;\n    baseURL: string;\n\n    /* logs loads of information to console. */\n    debug: boolean;\n    \n    /* \n        disables features like path name mutation,\n        request transforms, and other various things.\n    */\n    minimal: boolean;\n\n    /* prevents requests from throwing on response errors. */\n    nothrow: boolean;\n\n    events?: {\n        override?: boolean;\n        pre?: (this: HTTP, path: string, options: PartialHTTPOptions) =\u003e Promise\u003cboolean\u003e;\n        post?: (this: HTTP, result: any, path: string, options: PartialHTTPOptions) =\u003e Promise\u003ctypeof result\u003e;\n    }\n\n    /* for path params */\n    [key: string]: unknown\n}\n\n// equivalent of new HTTP(options, immutable)\nHTTP.create (options: Partial\u003cHTTPOptions\u003e = {}, immutable? = false): HTTP;\n\n// mutate the current HTTP instance options.\nhttp.mutate (options: Partial\u003cHTTPOptions\u003e): HTTP;\n\n// copy the current instance options onto a new instance, and apply addtional options.\nhttp.clone (options: Partial\u003cHTTPOptions\u003e): HTTP;\n\n// send a request with the GET method.\nhttp.get (path: string, options: Partial\u003cHTTPOptions\u003e = {}): Promise\u003cunknown\u003e;\n\n// send a request with the HEAD method.\nhttp.head (path: string, options: Partial\u003cHTTPOptions\u003e = {}): Promise\u003cunknown\u003e;\n\n// send a request with the POST method and body.\nhttp.post (path: string, body: BodyInit, options: Partial\u003cHTTPOptions\u003e = {}): Promise\u003cunknown\u003e;\n\n// send a request with the PATCH method and body.\nhttp.patch (path: string, body: BodyInit, options: Partial\u003cHTTPOptions\u003e = {}): Promise\u003cunknown\u003e;\n\n// send a request with the PUT method and body.\nhttp.put (path: string, body: BodyInit, options: Partial\u003cHTTPOptions\u003e = {}): Promise\u003cunknown\u003e;\n\n// send a request with the delete method and an optional body.\nhttp.delete (path: string, body?: BodyInit, options: Partial\u003cHTTPOptions\u003e = {}): Promise\u003cunknown\u003e;\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fariesclark%2Fhttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fariesclark%2Fhttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fariesclark%2Fhttp/lists"}