{"_id":"@trex-arms/httpie","_rev":"2-1eac040363c000d40d2f699a0bae7d09","name":"@trex-arms/httpie","dist-tags":{"latest":"2.0.0-next.16"},"versions":{"2.0.0-next.14":{"name":"@trex-arms/httpie","version":"2.0.0-next.14","repository":{"type":"git","url":"git+https://github.com/trex-arms/httpie.git"},"description":"A fork of lukeed/httpie","browser":"xhr/index.mjs","unpkg":"xhr/index.min.js","worker":"fetch/index.mjs","module":"node/index.mjs","main":"node/index.js","types":"index.d.ts","license":"MIT","exports":{".":{"worker":"./fetch/index.mjs","browser":"./xhr/index.mjs","import":"./node/index.mjs","require":"./node/index.js"},"./node":{"import":"./node/index.mjs","require":"./node/index.js"},"./fetch":{"import":"./fetch/index.mjs","require":"./fetch/index.js"},"./browser":{"import":"./xhr/index.mjs","require":"./xhr/index.js"},"./xhr":{"import":"./xhr/index.mjs","require":"./xhr/index.js"},"./package.json":"./package.json"},"engines":{"node":">=10"},"scripts":{"pretest":"npm run build","build":"bundt --main --module --unpkg","test":"uvu -r esm test"},"modes":{"fetch":"src/fetch.js","node":"src/node.js","xhr":"src/xhr.js"},"keywords":["http","fetch","client","request","universal","promise","xhr"],"devDependencies":{"bundt":"1.1.2","esm":"3.2.25","uvu":"0.5.1"},"gitHead":"c9e655a75687eecc6edc68ac81669f9dad66b3ea","bugs":{"url":"https://github.com/trex-arms/httpie/issues"},"homepage":"https://github.com/trex-arms/httpie#readme","_id":"@trex-arms/httpie@2.0.0-next.14","_nodeVersion":"18.12.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-Z50ivxq7j1G5lUbpRaKKwNoNVrRPEuUDajBg5PtQcLNpHaWx/cbCyUm2ZWfqamtCKVWvZfUb5A/F9kr0PaFoLQ==","shasum":"67f8dda8f97d9eb298d4f7100566e19b15f30718","tarball":"https://registry.npmjs.org/@trex-arms/httpie/-/httpie-2.0.0-next.14.tgz","fileCount":16,"unpackedSize":26887,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG5qfuJDFX6R5h2IcxKwpQe9PYZeeAFZCJPkeU1pRdBuAiAYtm2Y/PvuuWFDM71SyKguwRIccphMzJzrDLQ6637y0A=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj2Cc7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoc5RAAo+7h8Gfp33EkkhcKRidBbiQ5oj8Uq3A5XRW0P7qNxjk45zdP\r\nZ35G53f2nUGmll/n1vLUSxZ/Gij6Dk/eaQp5WENMFo83Q//pBfIrHUIsNiAM\r\nIE5ZqSD0Iu6negRYi6TrvxAMjIzKsGeHhqnLNcRY277r5XOv9yEvXPlQ6p+G\r\nseSB/s0223w+BuxdhiTGkGQ0+2N6HtOp5+MX2bw6I5/5+I2I6ua+fbUtYaVC\r\n7mnMfUX0DR0Avp8tOXeNvxq/0UeD6kupMBpY1vYDnlpyrkcfpbZikHGFKfTc\r\nh3Ub733UaFYg2xRug7qpAgjDA6+xC3JGteAvEKYiA04xY2geKwySpIAgYAUf\r\nuVOkVqOzYo2WntFOBdaJTOioFh2S0jhiMI8LCqI3znodc9IEUcxHqgJtXP5B\r\nWGf+b74BfeF8P8RbAFq2SLr8zYeDvPzLOLj7cBZRnPpTGpRK1vmSYgxRf9LH\r\nZ/xsVb+sC3wcgiyE1fuRq93XX1gUxcifLf6guDyuO6E7hWRb5JDSa6avTKed\r\nJ23X5uy3Hqtw8jj/lXDGCQjsBGF1Tm8tLGS3osMmU6i1lDWPw9j6NT+d3igl\r\nA/Moxy+CZl3/3dT9v/HqeBvsaBTjmqWxL9iK7e+VQDBg2q7snz5+VQtqIuYb\r\naVWADvjbV3lVCYy9DMDhpjmkFqXOZb3moxo=\r\n=Wdfa\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"artskydj","email":"josephdykstra@gmail.com"},"directories":{},"maintainers":[{"name":"njbotkin","email":"njbotkin@gmail.com"},{"name":"artskydj","email":"josephdykstra@gmail.com"},{"name":"tehshrike","email":"me@JoshDuff.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/httpie_2.0.0-next.14_1675110203508_0.2514520996198335"},"_hasShrinkwrap":false},"2.0.0-next.15":{"name":"@trex-arms/httpie","version":"2.0.0-next.15","repository":{"type":"git","url":"git+https://github.com/trex-arms/httpie.git"},"description":"A fork of lukeed/httpie","browser":"xhr/index.mjs","unpkg":"xhr/index.min.js","worker":"fetch/index.mjs","module":"node/index.mjs","main":"node/index.js","types":"index.d.ts","license":"MIT","exports":{".":{"worker":"./fetch/index.mjs","browser":"./xhr/index.mjs","import":"./node/index.mjs","require":"./node/index.js"},"./node":{"import":"./node/index.mjs","require":"./node/index.js"},"./fetch":{"import":"./fetch/index.mjs","require":"./fetch/index.js"},"./browser":{"import":"./xhr/index.mjs","require":"./xhr/index.js"},"./xhr":{"import":"./xhr/index.mjs","require":"./xhr/index.js"},"./package.json":"./package.json"},"engines":{"node":">=10"},"scripts":{"pretest":"npm run build","build":"bundt --main --module --unpkg","test":"uvu -r esm test"},"modes":{"fetch":"src/fetch.js","node":"src/node.js","xhr":"src/xhr.js"},"keywords":["http","fetch","client","request","universal","promise","xhr"],"devDependencies":{"bundt":"1.1.2","esm":"3.2.25","uvu":"0.5.1"},"gitHead":"1bd1e17c003085e0063570e8c3f20463d757c0e1","bugs":{"url":"https://github.com/trex-arms/httpie/issues"},"homepage":"https://github.com/trex-arms/httpie#readme","_id":"@trex-arms/httpie@2.0.0-next.15","_nodeVersion":"18.12.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-RmB/bWtnV8NUJsTjV++ixIFos0nCA6mvVJ/v9GC73fgbsjiSfRnpRMVBxrJfjHIaX8WseuH1VGwBacCp1IDpkQ==","shasum":"4a337c06464664ed761bbaa1c0213401f9a0ac91","tarball":"https://registry.npmjs.org/@trex-arms/httpie/-/httpie-2.0.0-next.15.tgz","fileCount":16,"unpackedSize":27576,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHbUsSn2qZgQPNx2vNDK23fau1DyC9SRJ0/aGDohY6CTAiEAjj2B7NiWyFgEh/BQ33LEuubTfQNycsagygMAE8t5gJg="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj2Da/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoMqw//biuM7/0Vg4ICCEuYit1UIgjowesX0PKtwSJu3rZs5fGijHHr\r\n2ZxtS/7P0UuasD03cVupGiEW+jgjIJ4aM8obl/UsynfO/0NtaYjkwycio1rj\r\nhi4VNtfY9NVXHWFJm2YmEbgz1YNvi9W7ec7bU9e5c0LaxUwH91anDJBU/DhE\r\n7fHcZVeEwyMdr2X4Kj/OUP0iF+xxkh9XvRAPfppdA9OekZTT2+zQY86AOXyK\r\nphBC5tm+Qitje8z/tYAWuVjpyzrj3p5DXd02rn36glcfYnzt0RcYOzDb1d/k\r\n0xp0POZoISBGd8WjB1tgoSiIdpSnc7L8Zmsp6iIgQmbK46PJtn+sH4+QzXMP\r\nSyeMGc5dCLRIGwgTNZfc2XQeiSe4nQYbxGA8nje1y4Osfd2G79e2OFwvBMnL\r\n/Oyl0OVHpm+/nQlRSsYhWKuUW2JK50GL85xvYCqGTNnSlurgPYeNSr7uMD+K\r\nWNpIng60sf7bTB7Wxb2gVbq/o2c0ByzIeJfELI/WIX3nNJwcdhIPKSE8GHLL\r\ntJcgg11JfS4g4M68KHkVBcZR3xQ1YqGp5VNTufOWCmiELgupc6T5IGaHWMr1\r\neuffeXBHwT/jKY4u8tPX+s+8CHJvpDBYptnnSlyTF7xjhNbnzVpxwjFc4XIh\r\n5xD9O7lvZkjsSGPQt6RAcrZiUcGTEGzKrGI=\r\n=giba\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"artskydj","email":"josephdykstra@gmail.com"},"directories":{},"maintainers":[{"name":"njbotkin","email":"njbotkin@gmail.com"},{"name":"artskydj","email":"josephdykstra@gmail.com"},{"name":"tehshrike","email":"me@JoshDuff.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/httpie_2.0.0-next.15_1675114174851_0.2607347119465282"},"_hasShrinkwrap":false},"2.0.0-next.16":{"name":"@trex-arms/httpie","version":"2.0.0-next.16","repository":{"type":"git","url":"git+https://github.com/trex-arms/httpie.git"},"description":"A fork of lukeed/httpie","browser":"xhr/index.mjs","unpkg":"xhr/index.min.js","worker":"fetch/index.mjs","module":"node/index.mjs","main":"node/index.js","types":"index.d.ts","license":"MIT","exports":{".":{"worker":"./fetch/index.mjs","browser":"./xhr/index.mjs","import":"./node/index.mjs","require":"./node/index.js"},"./node":{"import":"./node/index.mjs","require":"./node/index.js"},"./fetch":{"import":"./fetch/index.mjs","require":"./fetch/index.js"},"./browser":{"import":"./xhr/index.mjs","require":"./xhr/index.js"},"./xhr":{"import":"./xhr/index.mjs","require":"./xhr/index.js"},"./package.json":"./package.json"},"engines":{"node":">=10"},"scripts":{"pretest":"npm run build","build":"bundt --main --module --unpkg","test":"uvu -r esm test"},"modes":{"fetch":"src/fetch.js","node":"src/node.js","xhr":"src/xhr.js"},"keywords":["http","fetch","client","request","universal","promise","xhr"],"devDependencies":{"bundt":"1.1.2","esm":"3.2.25","uvu":"0.5.1"},"gitHead":"a0667647e177a8a64fe476be1993597cb0dcfc68","bugs":{"url":"https://github.com/trex-arms/httpie/issues"},"homepage":"https://github.com/trex-arms/httpie#readme","_id":"@trex-arms/httpie@2.0.0-next.16","_nodeVersion":"18.12.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-EsL+MA4KXispwS33JWpO2D6mhYbUAd9hBkLEsZikKvRXxdKGQpBx5kDX0B9YrahyFgzDeiAVLAfmZ77ZCeoV1w==","shasum":"d4332603926d96b7dd35a9b7c1b7da6276b7d0d3","tarball":"https://registry.npmjs.org/@trex-arms/httpie/-/httpie-2.0.0-next.16.tgz","fileCount":16,"unpackedSize":27737,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDm1nazX51zJE024UDI5zlg0JJq40EENkYABjcZSEHcIAiEA4jdyjcJd1R9Phj+Yw/XXAd/37pQzIGoMWbWv00eJvOg="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj2UZ3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrsUhAAj9Q3nZJaLshhvLCpkPT7+1y6FVX5ExJAnwyNiiNgW8oCq6/B\r\n+pf3l7AbrjCEzcC9F5nD2uvhOY0MnzR6ZDptDRD4jM1xia/H/j6m+QuaH6RR\r\n4C8Feb87o6crWGWsDPICEfIevzKc7/ImbaFXPEZyhMOFkcUj7k/ewqHcyrBN\r\n9GSsSFRoX6weRIniRwxHXWikXws7gYu7WtF/cHkpCqSD4X5jTNZm8sjRnxfa\r\nO0NZpcR0yL4W3eHreMVoIh0Ypi8dUUNfkFtAxSuu/ypRdCsU2k63tDziNTld\r\nISUsVA/rQzW8+PvsXSPrD05xyp1dGm/IuNDpnaN50t3Mg5Qeq3oLC27beYRU\r\n7ri/q7emEYpMUQD+/LsmA130mSxLIEKcraVLp3PDVUDC9O4RrFOB0UFoRYoL\r\nnkBwLBJjqc7bNA2QfF4mW3HTfvArEJBLlPuj5yZvzrupF+Wx9e720ylb57Lm\r\nG7wboHwhwC8HX3cQhvg6rqCukbYmULdY/8iI0Yz3I/ULDPz3vFv+ZyobhjsA\r\nDuYmhhH7QgIlYBYY5TChQ9BaFfGMRLOVdg/qHANFgTdxelcR4LLX62nBxanu\r\nT1tMOJm8T3BuzcNMaKYYvbqOFKrlA4irqu7W6OP5ylsR2gzowJ1x9eru4Ksi\r\ne1dKBSw4+KNbSmxIpCO37k7x78t7gbBsaIg=\r\n=lzi4\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"artskydj","email":"josephdykstra@gmail.com"},"directories":{},"maintainers":[{"name":"njbotkin","email":"njbotkin@gmail.com"},{"name":"artskydj","email":"josephdykstra@gmail.com"},{"name":"tehshrike","email":"me@JoshDuff.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/httpie_2.0.0-next.16_1675183735444_0.2315176941018129"},"_hasShrinkwrap":false}},"time":{"created":"2023-01-30T20:23:23.324Z","2.0.0-next.14":"2023-01-30T20:23:23.684Z","modified":"2023-01-31T16:48:55.744Z","2.0.0-next.15":"2023-01-30T21:29:35.012Z","2.0.0-next.16":"2023-01-31T16:48:55.600Z"},"maintainers":[{"name":"njbotkin","email":"njbotkin@gmail.com"},{"name":"artskydj","email":"josephdykstra@gmail.com"},{"name":"tehshrike","email":"me@JoshDuff.com"}],"description":"A fork of lukeed/httpie","homepage":"https://github.com/trex-arms/httpie#readme","keywords":["http","fetch","client","request","universal","promise","xhr"],"repository":{"type":"git","url":"git+https://github.com/trex-arms/httpie.git"},"bugs":{"url":"https://github.com/trex-arms/httpie/issues"},"license":"MIT","readme":"<div align=\"center\">A Node.js and browser HTTP client as easy as pie!</div>\n\n## Differences from [`httpie`](https://github.com/lukeed/httpie)\n\n* Added `err.request_uri` and `err.request_body`\n* Handles leading [byte order marks](https://en.wikipedia.org/wiki/Byte_order_mark) in JSON responses\n\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**!  Less than 1000 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 @trex-arms/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#### opts.withCredentials\nType: `Boolean`<br>\nDefault: `false`\n\nWhether or not cross-site requests should include credentials (such as cookies).<br>\nThis value is passed directly to [`XMLHttpRequest.withCredentials`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials).\n\n**Important**: This is for the **browser version** only!\n\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* `err.request_uri` – `String` or `URL` – The request's URI;\n* `err.request_body` – `String` – The request'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.uri);\n  console.error(`~> ${err.data}`);\n});\n//=> \"(404) Not Found\"\n//=> \"text/html; charset=UTF-8\"\n//=> \"https://example.com/404\"\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","readmeFilename":"readme.md"}