{"id":16473458,"url":"https://github.com/kingrayhan/request-resource","last_synced_at":"2025-09-05T21:37:12.588Z","repository":{"id":96069878,"uuid":"157247746","full_name":"kingRayhan/request-resource","owner":"kingRayhan","description":"🚀 🔥 Promise based HTTP client for the browser and node.js","archived":false,"fork":false,"pushed_at":"2018-11-12T17:09:32.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T12:43:21.044Z","etag":null,"topics":["ajax","ajax-request","http-client","http-request"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/request-resource","language":"JavaScript","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/kingRayhan.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-12T17:04:15.000Z","updated_at":"2019-07-26T12:47:09.000Z","dependencies_parsed_at":"2023-05-06T15:16:41.566Z","dependency_job_id":null,"html_url":"https://github.com/kingRayhan/request-resource","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kingRayhan/request-resource","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingRayhan%2Frequest-resource","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingRayhan%2Frequest-resource/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingRayhan%2Frequest-resource/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingRayhan%2Frequest-resource/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kingRayhan","download_url":"https://codeload.github.com/kingRayhan/request-resource/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingRayhan%2Frequest-resource/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273826405,"owners_count":25175232,"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-05T02:00:09.113Z","response_time":402,"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":["ajax","ajax-request","http-client","http-request"],"created_at":"2024-10-11T12:27:01.604Z","updated_at":"2025-09-05T21:37:12.581Z","avatar_url":"https://github.com/kingRayhan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Request Resource\n\n🚀 🔥 Promise based HTTP client for the browser and node.js\n\n### Installation\n\nUsing **npm**:\n\n```bash\nnpm install request-resource\n```\n\nUsing **yarn**:\n\n```bash\nyarn add request-resource\n```\n\n## Example\n\nGet resource from an endpoint\n\n```js\nimport resource from 'request-resource'\n\nresource\n    .get('https://jsonplaceholder.typicode.com/posts/1')\n    .then(d =\u003e console.log(d))\n    .catch(e =\u003e console.error(e))\n\n// Response -\u003e\n/*\n    {\n        data: {\n            body: \"quia et suscipit.....\"\n            id: 1\n            title: \"sunt aut facere.....\"\n            userId: 1\n        }, \n        headers: {\n            cache-control: \"public, max-age=14400\"\n            content-type: \"application/json; charset=utf-8\"\n            expires: \"Mon, 12 Nov 2018 20:40:35 GMT\"\n            pragma: \"no-cache\"\n        }, \n        statusCode: 200\n    }\n*/\n```\n\n\u003e **NOTE**: async/await is part of ECMAScript 2017 and is not supported in Internet Explorer and older browsers, so use with caution.\n\nPerforming a POST request\n\n```js\nimport resource from 'request-resource'\n\nresource\n    .post('https://jsonplaceholder.typicode.com/posts', {\n        title: 'new Post',\n        body: 'new post body',\n    })\n    .then(d =\u003e console.log(d))\n    .catch(e =\u003e console.error(e))\n```\n\n## Available methods\n\n-   resource.get(url, formData , [, config])\n-   resource.post(url, formData , [, config])\n-   resource.delete(url, formData , [, config])\n-   resource.put(url, formData , [, config])\n-   resource.head(url, formData , [, config])\n-   resource.option(url, formData , [, config])\n-   resource.head(url, formData , [, config])\n\n**url**: (String) Resouce endpoint url\n**formData**: (Object) data to be sent as the request body. Only applicable for request methods **PUT**, **POST**, and **PATCH**\n**config**: (Object) configaration object of `request-resource` library\n\nconfig object schema\n\n```js\n// todo: add moto config to config\n{\n    headers: {\n    }\n}\n```\n\n## Response Schema\n\n```js\n{\n  // `data` is the response that was provided by the server\n  data: {},\n\n  // `status` is the HTTP status code from the server response\n  statusCode: 200,\n\n  // `headers` the headers that the server responded with\n  // All header names are lower cased\n  headers: {},\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkingrayhan%2Frequest-resource","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkingrayhan%2Frequest-resource","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkingrayhan%2Frequest-resource/lists"}