{"id":13451807,"url":"https://github.com/lukeed/httpie","last_synced_at":"2025-10-09T18:23:35.483Z","repository":{"id":34070034,"uuid":"158334525","full_name":"lukeed/httpie","owner":"lukeed","description":"A Node.js HTTP client as easy as pie! 🥧","archived":false,"fork":false,"pushed_at":"2024-01-20T17:35:25.000Z","size":65,"stargazers_count":575,"open_issues_count":9,"forks_count":20,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-13T19:49:33.901Z","etag":null,"topics":["http","http-client","nodejs","promises"],"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/lukeed.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-20T05:16:06.000Z","updated_at":"2024-05-10T20:45:58.627Z","dependencies_parsed_at":"2024-05-10T20:45:53.030Z","dependency_job_id":"50ebb380-ee2b-4a44-8737-fde3e5e9261b","html_url":"https://github.com/lukeed/httpie","commit_stats":{"total_commits":54,"total_committers":5,"mean_commits":10.8,"dds":0.07407407407407407,"last_synced_commit":"8d8f45e9d6be87a1782a0f0ad165047e50ea6009"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fhttpie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fhttpie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fhttpie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fhttpie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukeed","download_url":"https://codeload.github.com/lukeed/httpie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245158378,"owners_count":20570174,"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","http-client","nodejs","promises"],"created_at":"2024-07-31T07:01:03.245Z","updated_at":"2025-10-09T18:23:30.456Z","avatar_url":"https://github.com/lukeed.png","language":"JavaScript","readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"logo.png\" alt=\"httpie\" height=\"190\" /\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://npmjs.org/package/httpie\"\u003e\n    \u003cimg src=\"https://badgen.now.sh/npm/v/httpie\" alt=\"version\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://travis-ci.org/lukeed/httpie\"\u003e\n    \u003cimg src=\"https://badgen.now.sh/travis/lukeed/httpie\" alt=\"travis\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/lukeed/httpie\"\u003e\n    \u003cimg src=\"https://badgen.now.sh/codecov/c/github/lukeed/httpie\" alt=\"codecov\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://npmjs.org/package/httpie\"\u003e\n    \u003cimg src=\"https://badgen.now.sh/npm/dm/httpie\" alt=\"downloads\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003eA Node.js HTTP client as easy as pie!\u003c/div\u003e\n\n## Features\n\n* `Promise`- based HTTP requestor\n* Works with HTTP and HTTPS protocols\n* Automatically handles JSON requests and responses\n* Extremely lightweight with **no dependencies** 678 bytes!\n* Includes aliases for common HTTP verbs: `get`, `post`, `put`, `patch`, and `del`\n\nAdditionally, this module is delivered as:\n\n* **ES Module**: [`dist/httpie.mjs`](https://unpkg.com/httpie/dist/httpie.mjs)\n* **CommonJS**: [`dist/httpie.js`](https://unpkg.com/httpie/dist/httpie.js)\n\n\n## Install\n\n```\n$ npm install --save httpie\n```\n\n\n## Usage\n\n\u003e **Note:** The `async` syntax is for demo purposes – you may use Promises in a Node 6.x environment too!\n\n```js\nimport { get, post } from 'httpie';\n\ntry {\n  const { data } = await get('https://pokeapi.co/api/v2/pokemon/1');\n\n  // Demo: Endpoint will echo what we've sent\n  const res = await post('https://jsonplaceholder.typicode.com/posts', {\n    body: {\n      id: data.id,\n      name: data.name,\n      number: data.order,\n      moves: data.moves.slice(0, 6)\n    }\n  });\n\n  console.log(res.statusCode); //=\u003e 201\n  console.log(res.data); //=\u003e { id: 1, name: 'bulbasaur', number: 1, moves: [{...}, {...}] }\n} catch (err) {\n  console.error('Error!', err.statusCode, err.message);\n  console.error('~\u003e headers:', err.headers);\n  console.error('~\u003e data:', err.data);\n}\n```\n\n\n## API\n\n### send(method, url, opts={})\nReturns: `Promise`\n\nAny `httpie.send` request (and its aliases) will always return a Promise.\n\nIf the response's `statusCode` is 400 or above, this Promise will reject with a formatted error – see [Error Handling](#error-handling). Otherwise, the Promise will resolve with the full [`ClientRequest`](https://nodejs.org/api/http.html#http_class_http_clientrequest) stream.\n\nThe resolved response will receive a new `data` key, which will contain the response's full payload. Should the response return JSON content, then `httpie` will parse it and the `res.data` value will be the resulting JSON object!\n\n#### method\nType: `String`\n\nThe HTTP method name – it must be uppercase!\n\n#### url\nType: `String` or [`URL`](https://nodejs.org/api/url.html#url_the_whatwg_url_api)\n\nIf `url` is a string, it is automatically parsed with [`url.parse()`](https://nodejs.org/api/url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost) into an object.\n\n#### opts.body\nType: `Mixed`\u003cbr\u003e\nDefault: `undefined`\n\nThe request's body, can be of any type!\n\nAny non-`Buffer` objects will be converted into a JSON string and the appropriate [`Content-Type`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) header will be attached.\n\nAdditionally, `httpie` will _always_ set a value for the [`Content-Length`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Length) header!\n\n#### opts.headers\nType: `Object`\u003cbr\u003e\nDefault: `{}`\n\nThe custom headers to send with your request.\n\n#### opts.redirect\nType: `Boolean`\u003cbr\u003e\nDefault: `true`\n\nWhether or not redirect responses should be followed automatically.\n\n\u003e **Note:** This may only happen with a 3xx status _and_ if the response had a [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location) header.\n\n#### opts.reviver\nType: `Function`\u003cbr\u003e\nDefault: `undefined`\n\nAn optional function that's passed directly to [`JSON.parse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Parameters), allowing you transform aspects of the response data before the `httpie` request resolves.\n\n\u003e **Note:** This will _only_ run if `httpie` detects that JSON is contained in the response!\n\n### get(url, opts={})\n\u003e Alias for [`send('GET', url, opts)`](#sendmethod-url-opts).\n\n### post(url, opts={})\n\u003e Alias for [`send('POST', url, opts)`](#sendmethod-url-opts).\n\n### put(url, opts={})\n\u003e Alias for [`send('PUT', url, opts)`](#sendmethod-url-opts).\n\n### patch(url, opts={})\n\u003e Alias for [`send('PATCH', url, opts)`](#sendmethod-url-opts).\n\n### del(url, opts={})\n\u003e Alias for [`send('DELETE', url, opts)`](#sendmethod-url-opts).\n\n\n## Error Handling\n\nAll responses with `statusCode \u003e= 400` will result in a rejected `httpie` request. When this occurs, an Error instance is formatted with complete information:\n\n* `err.message` – `String` – Identical to `err.statusMessage`;\n* `err.statusMessage` – `String` – The response's `statusMessage` value;\n* `err.statusCode` – `Number` – The response's `statusCode` value;\n* `err.headers` – `Object` – The response's `headers` object;\n* `err.data` – `Mixed` – The response's payload;\n\n\u003e **Important:** The error's `data` property may also be parsed to a JSON object, according to the response's headers.\n\n```js\nimport { get } from 'httpie';\n\nget('https://example.com/404').catch(err =\u003e {\n  console.error(`(${err.statusCode}) ${err.message}`)\n  console.error(err.headers['content-type']);\n  console.error(`~\u003e ${err.data}`);\n});\n//=\u003e \"(404) Not Found\"\n//=\u003e \"text/html; charset=UTF-8\"\n//=\u003e ~\u003e \u003c?xml version=\"1.0\" encoding=\"iso-8859-1\"?\u003e\\n\u003c!DOCTYPE html ...\u003c/body\u003e\\n\u003c/html\u003e\n```\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","funding_links":[],"categories":["JavaScript","Packages"],"sub_categories":["HTTP"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeed%2Fhttpie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukeed%2Fhttpie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeed%2Fhttpie/lists"}