{"id":20629874,"url":"https://github.com/conorturner/urequest","last_synced_at":"2026-05-08T05:52:46.179Z","repository":{"id":205822857,"uuid":"137399912","full_name":"conorturner/urequest","owner":"conorturner","description":"Promise based zero dependency node.js http request module","archived":false,"fork":false,"pushed_at":"2019-08-29T08:53:37.000Z","size":72,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T18:53:27.540Z","etag":null,"topics":["http","http-client","https","nodejs","npm-package","request"],"latest_commit_sha":null,"homepage":"","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/conorturner.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}},"created_at":"2018-06-14T19:25:35.000Z","updated_at":"2021-07-02T14:11:12.000Z","dependencies_parsed_at":"2023-11-07T00:43:48.919Z","dependency_job_id":null,"html_url":"https://github.com/conorturner/urequest","commit_stats":null,"previous_names":["conorturner/urequest"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/conorturner/urequest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conorturner%2Furequest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conorturner%2Furequest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conorturner%2Furequest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conorturner%2Furequest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/conorturner","download_url":"https://codeload.github.com/conorturner/urequest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conorturner%2Furequest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32769110,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T02:36:36.067Z","status":"ssl_error","status_checked_at":"2026-05-08T02:36:07.210Z","response_time":54,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["http","http-client","https","nodejs","npm-package","request"],"created_at":"2024-11-16T14:06:17.685Z","updated_at":"2026-05-08T05:52:46.152Z","avatar_url":"https://github.com/conorturner.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# urequest\n\n[![npm](https://img.shields.io/npm/dt/urequest.svg?style=for-the-badge)](https://www.npmjs.com/package/urequest)\n[![Travis](https://img.shields.io/travis/conorturner/urequest.svg?style=for-the-badge)](https://travis-ci.org/conorturner/urequest)\n[![Coveralls github](https://img.shields.io/coveralls/github/conorturner/urequest.svg?style=for-the-badge)](https://coveralls.io/github/conorturner/urest)\n![license](https://img.shields.io/github/license/conorturner/urequest.svg?style=for-the-badge)\n![npm bundle size (minified)](https://img.shields.io/bundlephobia/min/urequest.svg?style=for-the-badge)\n\n\n\n## Install\n\n```bash\n$ npm install urequest\n```\n\n\n\n## Basic Usage\n\n```javascript\nconst { URequest } = require(\"urequest\");\nconst u = new URequest();\n\nu.request(\"https://www.google.com\")\n   .then(result =\u003e {\n      console.log(result);\n   })\n   .catch(error =\u003e {\n      console.error(error.statusCode);\n      console.error(error.body);\n   });\n```\n\n\n## Options\n\n| Property |              Description              | Example                  | Default |\n|----------|:-------------------------------------:|--------------------------|---------|\n| method   |              HTTP Method              | POST                     | GET     |\n| port     |       Destination port on Server      | 8080                     | 80      |\n| headers  |              HTTP Headers             | {\"a-header\": \"value\"}    | {}      |\n| qs       |        Query string parameters        | ?a=b\u0026b=1,2,3             | {}      |\n| uri      |              Standard URI             | https://www.a.com:8080   |         |\n| body     |               HTTP Body               | Buffer, string or object |         |\n| path     | Path will be appended to the uri path | /path/to/data            |         |\n| json     | If the request and response are JSON  | {json: true}             | false   |\n\n\n## Examples\n\n#### Catch Errors\n\n```javascript\nconst options = { uri: \"http://localhost:8123/error\", json: true };\n\nu.request(options)\n   .then(done)\n   .catch(({ body, statusCode }) =\u003e {\n      expect(statusCode).to.be.a(\"number\");\n      expect(body).to.be.an(\"object\");\n   })\n```\n\n#### Post JSON\n\n```javascript\nconst body = {\n   message: \"hi\"\n};\n\nconst options = {\n   method: \"POST\",\n   uri: \"http://my-api/echo\",\n   body,\n   json: true\n};\n\nu.request(options)\n   .then(result =\u003e ...\n```\n\n**Note:** If the response body is an invalid JSON, the promise will be rejected with the body variable undefined.\n\n#### Overwriting URI Components\n\n```javascript\nconst options = {\n   uri: \"http://my-api:8080/echo\",\n   port: 80,\n   path: \"/echo\",\n   qs: {\n      utms: \"abc123\",\n      arr: [1,2,3]\n   }\n   json: true\n};\n\n// Will resolve http://my-api:80/echo/echo?utms=abc123\u0026arr=1,2,3\n```\n\n\n\n## Neutron\n\nNeutron is a compression wrapper library built around node zlib and streams API's. It provides a set of simple interface methods supporting both gzip and deflate.\n\n#### Compress and Decompress\n\n```js\nconst { Neutron } = require(\"urequest\");\nconst inputString = \"compress me!\"\nconst buffer = Buffer.from(inputString);\nconst encoding = \"gzip\";\n\nconst compressedStream = Neutron.compress(buffer, encoding);\nconst decompressedStream = Neutron.decompress(compressedStream, encoding);\n\nNeutron.flattenStream(decompressedStream)\n   .then(output =\u003e {\n      expect(output.toString()).to.equal(inputString);\n      done();\n   })\n```\n\n#### URest Middleware and Interceptors\n\n```javascript\n// server\n\nconst { Rest, JsonBodyParser } = require(\"urest\");\nconst { Neutron } = require(\"urequest\");\nconst app = new Rest();\n\napp.pre(Neutron.middleware());\napp.pre(JsonBodyParser.middleware());\napp.post(\"/echo\", (req, res) =\u003e res.send(req.body));\napp.native().listen(1234);\n\n\n// client\n\nconst { URequest } = require(\"urequest\");\nconst u = new URequest();\n\nconst body = {\n   message: \"hi\"\n};\n\nconst options = {\n   method: \"POST\",\n   uri: \"http://localhost:1234/echo\",\n   body,\n   json: true,\n   gzip: true\n};\n\nu.request(options)\n   .then(result =\u003e {\n   \t  expect(result).to.deep.equal(body);\n   })\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconorturner%2Furequest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconorturner%2Furequest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconorturner%2Furequest/lists"}