{"id":16625481,"url":"https://github.com/aleclarson/quest","last_synced_at":"2026-05-16T15:38:06.483Z","repository":{"id":57096228,"uuid":"115812352","full_name":"aleclarson/quest","owner":"aleclarson","description":"Isomorphic HTTP requests","archived":false,"fork":false,"pushed_at":"2018-12-15T07:45:29.000Z","size":30,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-22T05:03:38.585Z","etag":null,"topics":["http","isomorphic","nodejs","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/aleclarson.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":"2017-12-30T17:34:42.000Z","updated_at":"2018-11-09T14:42:28.000Z","dependencies_parsed_at":"2022-08-22T21:40:56.007Z","dependency_job_id":null,"html_url":"https://github.com/aleclarson/quest","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleclarson%2Fquest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleclarson%2Fquest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleclarson%2Fquest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleclarson%2Fquest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aleclarson","download_url":"https://codeload.github.com/aleclarson/quest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243030819,"owners_count":20224667,"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":["http","isomorphic","nodejs","request"],"created_at":"2024-10-12T04:05:50.817Z","updated_at":"2026-05-16T15:38:01.448Z","avatar_url":"https://github.com/aleclarson.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# quest v0.9.0\n\nBare bones HTTP requests for browser and server.\n\n### `quest(method, url, headers)`\n\nSend any request, and return the request stream immediately.\n\n```js\nconst req = quest('POST', 'http://your-api.com/users/1')\nreq.on('response', (res) =\u003e {\n  if (res.statusCode != 201) {\n    console.warn('Failed to create user!')\n  }\n})\nreq.write(JSON.stringify({id: 'aleclarson', age: 23}))\nreq.end()\n```\n\n### `quest.stream(url, headers)`\n\nSend a `GET` request, and return the response stream immediately.\n\n```js\nconst res = quest.stream('https://stream.twitter.com/1.1')\nres.on('data', console.log)\nres.on('error', (error) =\u003e {\n  error.args // =\u003e ['https://stream.twitter.com/1.1']\n  error.req // =\u003e The request stream\n  error.res // =\u003e The response stream\n})\n```\n\n### `quest.fetch(url, headers)`\n\nSend a `GET` request, then buffer the entire response into memory.\n\n```js\nconst buffer = await quest.fetch('https://loripsum.net/api')\nBuffer.isBuffer(buffer) // =\u003e true\n```\n\n### `quest.json(url, headers)`\n\nSend a `GET` request, then parse the response as JSON.\n\n```js\nconst json = await quest.json('https://your-api.com')\nif (json == null) {\n  console.log('The response was empty')\n}\n```\n\n## Tips and tricks\n\nIn NodeJS, the `stream`, `fetch`, and `json` functions all accept a `ClientRequest` object (the same object type that `quest()` returns). This means you can easily avoid lots of boilerplate code for non-GET requests.\n\n```js\nconst req = quest('PUT', 'https://localhost:8000', headers)\nreq.write(json)\n\n// Convert the ClientRequest into a response object.\nquest.stream(req)\n  .on('data', (data) =\u003e {})\n  .on('error', (err) =\u003e {})\n\n// Convert the ClientRequest into a Buffer promise.\nquest.fetch(req).then(buffer =\u003e {})\n\n// Convert the ClientRequest into a JSON promise.\nquest.json(req).then(data =\u003e {})\n```\n\n## Caveats\n\n- The `stream` function can only be used in NodeJS (for now)\n- The request object returned by `quest()` cannot be passed\n  to the other functions in the web version (yet)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleclarson%2Fquest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faleclarson%2Fquest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleclarson%2Fquest/lists"}