{"id":20160739,"url":"https://github.com/debdut/url-request","last_synced_at":"2025-10-11T07:15:13.550Z","repository":{"id":42754529,"uuid":"278717157","full_name":"Debdut/url-request","owner":"Debdut","description":"The most advanced HTTP Client with Functional Chaining, Async/Await, Delay, Fork, Infinite Chaining and Repeat for building your Complex APIs easily.","archived":false,"fork":false,"pushed_at":"2023-01-06T11:24:36.000Z","size":398,"stargazers_count":29,"open_issues_count":8,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-24T14:11:27.504Z","etag":null,"topics":["axios","chainer","fork","node-fetch","request","simple","url","url-builder"],"latest_commit_sha":null,"homepage":"https://github.com/Debdut/url-request#readme","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/Debdut.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":"2020-07-10T19:30:03.000Z","updated_at":"2024-12-28T04:02:03.000Z","dependencies_parsed_at":"2023-02-05T23:31:18.908Z","dependency_job_id":null,"html_url":"https://github.com/Debdut/url-request","commit_stats":null,"previous_names":["debdut/url"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/Debdut/url-request","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Debdut%2Furl-request","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Debdut%2Furl-request/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Debdut%2Furl-request/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Debdut%2Furl-request/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Debdut","download_url":"https://codeload.github.com/Debdut/url-request/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Debdut%2Furl-request/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263826343,"owners_count":23516757,"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","chainer","fork","node-fetch","request","simple","url","url-builder"],"created_at":"2024-11-14T00:15:32.312Z","updated_at":"2025-10-11T07:15:08.499Z","avatar_url":"https://github.com/Debdut.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# url-request\n\n[![Generic badge](https://img.shields.io/badge/build-1k-success.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/tests-100%25-brightgreen.svg)](https://shields.io/)\n[![Generic badge](https://img.shields.io/badge/async/await-yes-0390fc.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/functional-yes-fa166a.svg)](https://shields.io/)\n\n\u003e _The most advanced HTTP Client and Url Builder with Functional Chaining, Async/Await, Delay, Fork, Infinite Chaining and Repeat for building your Complex APIs easily._\n\nAlternative to Requests, Axios, and Got.\n\n## Installation\n\n```sh\nnpm install url-request --save\n```\n\n## Initialize\n\n```js\nconst Url = require('url-request')\n```\n\n## Examples\n\nLook [Examples](/examples)\n\n### Repeat\n\nBuilding a Ping server was never as easy! This pings at an interval of 1s and let's you know if you're connected or not.\n\n```js\nUrl('https://postman-echo.com/get')\n  .get()\n  .then(() =\u003e console.log('Ping Successful! Internet is up 🤟')) \n  .catch(() =\u003e console.log('Ping Failed! Internet is down 😭'))\n  .repeat(1000, 100) // time 1000ms\n```\n\n### GET Request w/ Promise\n\nSend a GET request with an access token, then display the result or catch errors.\n`GET https://my-json-server.typicode.com/typicode/demo/posts/comments`\n\n```js\nUrl('https://my-json-server.typicode.com')\n  .go('typicode/demo')\n  .go('posts')\n  .query({ access_token: 'MyAccessToken' })\n  .get() // GET Request\n  .then(json =\u003e console.log(json)) \n  .catch(err =\u003e console.error('[Error]', err))\n```\n```js\n[{ id: 1, post: 'Post 1' },\n { id: 2, post: 'Post 2' }]\n```\n\n### Build A Complex Url\n\nBuild Complex Urls with deep paths, multiple queries (lists are supported) and fragments.\n\n```js\nconst url = Url('https://api.workpay.com')\n  .go('rooms', 'open', 'users')\n  .query({ id: [10, 12, 13, 14] })\n  .query({ access_token: 'my-token', password: 'password'})\n  .fragment('bio')\n  .url\n  \n// https://api.workpay.com//rooms/open/users?id=10,12,13,14\u0026\n// access_token=my-token\u0026password=password#bio\n```\n\n### Invoke / Execute\n\n```js\nUrl('https://postman-echo.com')\n  .invoke('go', 'post')\n  .invoke('encodeResponse', null) // To Get Full Response Object\n  .invoke('post', { foo1: 'bar1', foo2: 'bar2' })\n  .execute()\n  .then(res =\u003e res.json())\n  .then(json =\u003e console.log(json))\n  .catch(err =\u003e console.error(err))\n```\n\n### Fork\n\n```js\nconst userApi = Url('https://api.workpay.com')\n  .go('user', 123)\n\nconst subscriptionsApi = userApi\n  .fork()\n  .fragment('subscriptions')\n\nconst achievementsApi = userApi\n  .fork()\n  .fragment('achievements')\n\n[ userApi, subscriptionsApi, achievementsApi ]\n  .forEach(api =\u003e api\n    .then(json =\u003e console.log(json))\n    .catch(err =\u003e console.log(err)))\n```\n\n### POST Request w/ Promise\n\nA POST request with a body `{ subscrbe: 'Apple Music' }` at `https://api.workpay.com/user/123#subscriptions`\n\n```js\nUrl('https://api.workpay.com')\n  .go('user', 123)\n  .fragment('subscriptions')\n  .post({ subscrbe: 'Apple Music' })\n  .then(json =\u003e console.log(json)) // { success: true }\n  .catch(err =\u003e console.error(err))\n```\n\n### Async/Await\n\n```js\nconst post = async () =\u003e {\n  const request = Url('https://postman-echo.com')\n    .go('post')\n    .post({ foo1: 'bar1', foo2: 'bar2' })\n  \n  return await request\n}\n```\n\n### Delay\n\nDelay your requests!\n\n```js\nUrl('https://postman-echo.com/post')\n  .delay(2000, () =\u003e console.log('Wait 2s'))\n  .post({ foo1: 'bar1', foo2: 'bar2' })\n\n```\n\n### Infinite Chain\n\nSee [Infinite Chain Example](/examples/infinite-chain.js)\n\n```js\nUrl('https://my-json-server.typicode.com')\n  .go('typicode/demo')\n  .go('posts')\n  .get()\n  .then(json =\u003e console.log('[1]', json)) \n  .catch(err =\u003e console.error('[Error]', err))\n  .go(1)\n  .get()\n  .then(json =\u003e console.log('[2]', json)) \n  .catch(err =\u003e console.error('[Error]', err))\n  .post()\n  .post()\n  ... // Keep on going!\n```\n\n## Functions\n\n```js\nclass Url {\n\n  // Url Construction\n  constructor (baseUri) // Start with the baseUri\n  go (...paths) // Go to Sub Path\n  query (q) // q is query object\n  fragment (f) // add fragments like #profile\n\n  // Fork\n  fork ()\n  \n  // default encoding is 'json', can be null, 'string', 'buffer'\n  encodeResponse (encoding) \n  \n  // Set headers\n  header (headers) \n\n  // get the formed url as a string\n  get url ()\n\n  // Requests\n  get (body, statusCode) // GET Request\n  post (body, statusCode) // POST Request\n  put (body, statusCode) // PUT Request\n  delete (body, statusCode) // DELETE Request\n  patch (body, statusCode) // PATCH Request\n\n  then (func)\n  catch (func)\n  finally (func)\n\n  delay (time, func)\n  repeat (time, count)\n\n  // Command Control, Lazy Execution\n  invoke (command, ...args)\n  execute (invokeCommands)\n}\n```\n\n## Upcoming\n\n- [ ] OAuth\n- [ ] HTTP2\n- [ ] Proxy\n- [ ] Compression\n- [ ] Timeout Handling\n- [ ] Custom Hooks\n- [ ] Request Cancellation\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdebdut%2Furl-request","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdebdut%2Furl-request","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdebdut%2Furl-request/lists"}