{"bugs":{"url":"https://github.com/lukeed/httpie/issues"},"dist":{"shasum":"553f1eabe43cce873a8c4857243a445f0ba3d83a","tarball":"https://registry.npmjs.org/httpie/-/httpie-2.0.0-next.3.tgz","fileCount":8,"integrity":"sha512-HIWXUBIywDIKOiZthjQJSTNdrzzGXq8exBWka5xwxn+Nw6iNOVlaN4r6/jzFFO7/Bhsi/eSI2yRV7aDMM7yT+g==","signatures":[{"sig":"MEYCIQC19v0nh5bS8izHvmR9jGuMpSpxXqL1FJfN9qKDIQ+zJwIhALssi32W0JTbnQOJcnTfyB8AEII9OUON59lbhnfgnR1l","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15938,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd99fACRA9TVsSAnZWagAAzPUP/joVzfsXJokXW7x6HOzY\n4cLPDNMZVoBgNbzrIepSVvJn2kA2Iaxh6qkA48XjdiF1l4NYIIqbqPNA9t/n\npHxzADTK1cfa1t/Wn0DKODPZdHFGRZ4tGqZC5fzwjxRRUGWL6pSQwcZjur8n\n9NFDy1IF0SoSidofimuk0ReVaHAJ3yoJTvFPsxof5dRJE1Bcgcx0PVINlr23\nSLR8ORnYLkhmXKGgePgQLqfoBnIhc4LfTnhtBlNrF5AljWGu46nbzPUpu7Zh\nfVbkBorH+XMvTT+ITEj3O8KGf5gpLG11wJ3M1mFrrS5q/K/Wo6mH9YttREHv\nNJF1h6nLoyWn/keAp8H6rdncpcDi9NwGx5iBer5ZMnTm9nIHENKMZB/gVpJB\nJNr4htuJC/iLTZl3QGfRecDaUn6lHV8ROSEe621ydfdQPGC8D8i8pyE5vSsK\nAwk1gCYjKk4cNtc1MI/M49hnanNJxw9c9Eo/DYe7BwOCwq41GwtHOEA8GM0A\ncWtVX2s+mLPR62nvsBp4//2MiKWz0jLYIB7fJWU5UycSKB3iGWaTlZcprD/U\nF/BHWpUyf4KTgKZuBX0Y+NQfWFgBvBqxhcmtTJp8xMbccyYhaZ3aOBdU22LG\nN3IpuTw6ciGfyz0KDgB12dWF4Bz6moHsQMNIkxeAD1JE3xvMR71/wcs6Oscm\nCwFq\r\n=TmQS\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/httpie.js","name":"httpie","types":"httpie.d.ts","unpkg":"dist/httpie.min.js","author":{"url":"lukeed.com","name":"Luke Edwards","email":"luke.edwards05@gmail.com"},"module":"dist/httpie.mjs","readme":"<div align=\"center\">\n  <img src=\"logo.png\" alt=\"httpie\" height=\"190\" />\n</div>\n\n<div align=\"center\">\n  <a href=\"https://npmjs.org/package/httpie\">\n    <img src=\"https://badgen.now.sh/npm/v/httpie\" alt=\"version\" />\n  </a>\n  <a href=\"https://travis-ci.org/lukeed/httpie\">\n    <img src=\"https://badgen.now.sh/travis/lukeed/httpie\" alt=\"travis\" />\n  </a>\n  <a href=\"https://codecov.io/gh/lukeed/httpie\">\n    <img src=\"https://badgen.now.sh/codecov/c/github/lukeed/httpie\" alt=\"codecov\" />\n  </a>\n  <a href=\"https://npmjs.org/package/httpie\">\n    <img src=\"https://badgen.now.sh/npm/dm/httpie\" alt=\"downloads\" />\n  </a>\n</div>\n\n<div align=\"center\">A Node.js HTTP client as easy as pie!</div>\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> **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); //=> 201\n  console.log(res.data); //=> { id: 1, name: 'bulbasaur', number: 1, moves: [{...}, {...}] }\n} catch (err) {\n  console.error('Error!', err.statusCode, err.message);\n  console.error('~> headers:', err.headers);\n  console.error('~> 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`<br>\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`<br>\nDefault: `{}`\n\nThe custom headers to send with your request.\n\n#### opts.redirect\nType: `Boolean`<br>\nDefault: `true`\n\nWhether or not redirect responses should be followed automatically.\n\n> **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`<br>\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> **Note:** This will _only_ run if `httpie` detects that JSON is contained in the response!\n\n#### opts.timeout\nType: `Integer`<br>\nDefault: `undefined`\n\nThe time, in milliseconds, before automatically terminating the request.\n\nWhen the request exceeds this limit, `httpie` rejects with an `err<Error>`, adding a truthy `err.timeout` value.\n\n> **Important:** There is a slight behavioral difference between the Node & browser versions!<br>\nIn the server, the `timeout` value _does not propagate_ to any redirects.<br>\nIn the browser, the `timeout` value _will not_ reset during redirects.\n\n\n### get(url, opts={})\n> Alias for [`send('GET', url, opts)`](#sendmethod-url-opts).\n\n### post(url, opts={})\n> Alias for [`send('POST', url, opts)`](#sendmethod-url-opts).\n\n### put(url, opts={})\n> Alias for [`send('PUT', url, opts)`](#sendmethod-url-opts).\n\n### patch(url, opts={})\n> Alias for [`send('PATCH', url, opts)`](#sendmethod-url-opts).\n\n### del(url, opts={})\n> Alias for [`send('DELETE', url, opts)`](#sendmethod-url-opts).\n\n\n## Error Handling\n\nAll responses with `statusCode >= 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\nAdditionally, errors that are a result of a timeout expiration will have a truthy `err.timeout` value.\n\n> **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 => {\n  console.error(`(${err.statusCode}) ${err.message}`)\n  console.error(err.headers['content-type']);\n  console.error(`~> ${err.data}`);\n});\n//=> \"(404) Not Found\"\n//=> \"text/html; charset=UTF-8\"\n//=> ~> <?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\\n<!DOCTYPE html ...</body>\\n</html>\n```\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","browser":"dist/httpie.esm.js","engines":{"node":">=8"},"gitHead":"efa8b4fa7ecf0cf1522fd9dc0b157291c2e6f786","license":"MIT","scripts":{"test":"tape -r esm test/*.js | tap-spec","build":"npm run build:node && npm run build:client","pretest":"npm run build","build:node":"bundt src/index.js --main --module","build:client":"bundt src/browser.js --unpkg --browser"},"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"homepage":"https://github.com/lukeed/httpie#readme","keywords":["http","client","request","promise"],"repository":{"url":"git+https://github.com/lukeed/httpie.git","type":"git"},"_npmVersion":"6.4.1","description":"A lightweight, Promise-based wrapper for Node.js HTTP requests~!","directories":{},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_nodeVersion":"10.13.0","_hasShrinkwrap":false,"readmeFilename":"readme.md","devDependencies":{"esm":"^3.2.0","tape":"^4.9.1","bundt":"^0.4.0","tap-spec":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/httpie_2.0.0-next.3_1576523711587_0.017922370032983803","host":"s3://npm-registry-packages"},"_id":"httpie@2.0.0-next.3","version":"2.0.0-next.3"}