{"_id":"@35up/http-client","_rev":"9-c6b62925d2f0d126f7107b9e921f2bf3","name":"@35up/http-client","dist-tags":{"latest":"2.3.1"},"versions":{"2.1.6":{"name":"@35up/http-client","version":"2.1.6","keywords":["http","client"],"author":{"name":"35up GmbH","email":"the.engineers@35up.com"},"license":"MIT","_id":"@35up/http-client@2.1.6","maintainers":[{"name":"drafter500","email":"vzemtsov@yahoo.com"},{"name":"schrodervictor","email":"schrodervictor@gmail.com"},{"name":"35up-npm","email":"npm@35up.com"}],"homepage":"https://github.com/35up/http-client#readme","bugs":{"url":"https://github.com/35up/http-client/issues"},"dist":{"shasum":"7965a9a29945ea4bf56e106e4c1c243dce525650","tarball":"https://registry.npmjs.org/@35up/http-client/-/http-client-2.1.6.tgz","fileCount":19,"integrity":"sha512-QsFWNjUv+S/IbUJ60OOK1Eb/tWEQRaCtBHZp39Nf4lcrd5Os2d89dTNuVl6EUv+KPB9bLRDvQQiJ4GGCcWKkUw==","signatures":[{"sig":"MEUCIHBU1pCA6hakEL2GmWkJgx0nGBO4zh2A61jYw2QcMCAZAiEA3nv/YqFNY2ERFk21khad5q9HvZfcrHNwpD057zl7io4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":67585,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkJZ7WACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqO8w//Y1o6tb6iGUcy2T7rPJRFf4bbDi/YL9o6YtTrIXpmzNCmRnvG\r\nuTwimyIWqmexSBgpr7T8TtATdEksFa1I/AzdUdrI3dPWAqqX/3O1m57qw847\r\ne7lJlCJGLK1BaBS5IRUkLK/vhWyISEYgPyKHEvYjLV3Ikjgipoo/XVG1lPSv\r\nbR8uBAI7v/WOaRuqc+BSqQbV6ehdfc1on6+k9Wnr/Ay1aFFr4/bYb8EChZcB\r\nZ9AYv94DyTUeHTg2D2z3nkN19TxCSKCL93wy5DPCm0fFfdRUgP9bCgxN6QL9\r\nOxaFr94aHXay/Hx04It9aytI8Y6XzJWFN7DIDD0WJ/xbwtMb/fOX/FR9qeh9\r\nrbUpL8JKhGUyg55gOHE85upySJpcczxHCrVzVGcr3Bbfsp/9mdfS5Pv35/MZ\r\nbqAxYpRaOs2y4jBR51eZDK5v55Ew1U1/EdyB8xkQhbm0gZ4o/RwDllXvK1fw\r\nS0M8dzi2y7wKQtxZ45KtQCu937jQXsidD6YpsERhmSRryVyn+v/+BY5OAz3B\r\ng9DN5DuXd2MfXS+vTwB+7qYyt4qKVi3QW/I6p+G3Tfgm1E2KszVYQTju0sOC\r\nc1J0CWi4LaRdiVA9fz43V/3M48WWfUSltv1JHDQqfry/zGOa6Tp989Jpkrrc\r\nUznfRnfdCSyqPEpPvxmkYgO0tQSvvxfHEDk=\r\n=2/8o\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/http-client.node.cjs","type":"module","types":"./dist/http-client.node.d.ts","module":"dist/http-client.js","exports":{"import":{"node":"./dist/http-client.node.js","default":"./dist/http-client.js"},"require":{"node":"./dist/http-client.node.cjs","default":"./dist/http-client.cjs"}},"gitHead":"98163b67f31ba5d4ca5737b927867b35adce5e27","scripts":{"ci":"npm i && npm run build && npm run lint && npm run test","lint":"eslint --ext .ts,.js .","test":"jest --passWithNoTests","build":"rollup --config","test:ci":"npm test -- --ci --forceExit --runInBand","test:watch":"npm run test -- --watch","test:coverage":"npm test -- --ci --json --coverage --testLocationInResults --outputFile=coverage/report.json","prepublishOnly":"npm i && npm run build && npm run lint && npm run test"},"_npmUser":{"name":"drafter500","email":"vzemtsov@yahoo.com"},"repository":{"url":"git+https://github.com/35up/http-client.git","type":"git"},"_npmVersion":"9.3.1","description":"Provides convenient apis to make http requests and handle the responses,  eliminates boilerplate code. It is basically a wrapper over XHR requests  (uses fetch).","directories":{},"_nodeVersion":"18.14.0","dependencies":{"node-fetch":"^2.6.7","@types/node-fetch":"^2.6.2"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.2.0","jest":"^26.6.3","sinon":"^11.1.2","tslib":"^2.4.1","eslint":"^8.22.0","rollup":"^2.33.1","core-js":"^3.7.0","sinon-chai":"^3.7.0","typescript":"^4.8.4","@babel/core":"^7.12.1","@types/chai":"^4.2.0","@types/jest":"^26.0.15","jest-fetch-mock":"^3.0.3","ts-mock-imports":"^1.3.0","@babel/preset-env":"^7.12.1","@types/sinon-chai":"^3.2.5","rollup-plugin-dts":"^4.2.2","@babel/preset-typescript":"^7.12.1","@rollup/plugin-typescript":"^8.5.0","@35up/eslint-config-35up-base":"^4.0.0","babel-plugin-transform-async-to-promises":"^0.8.15"},"_npmOperationalInternal":{"tmp":"tmp/http-client_2.1.6_1680187094736_0.8878969552967653","host":"s3://npm-registry-packages"}},"2.2.0":{"name":"@35up/http-client","version":"2.2.0","keywords":["http","client"],"author":{"name":"35up GmbH","email":"the.engineers@35up.com"},"license":"MIT","_id":"@35up/http-client@2.2.0","maintainers":[{"name":"enjoythelive1","email":"enjoythelive1@gmail.com"},{"name":"drafter500","email":"vzemtsov@yahoo.com"},{"name":"schrodervictor","email":"schrodervictor@gmail.com"},{"name":"35up-npm","email":"npm@35up.com"}],"homepage":"https://github.com/35up/http-client#readme","bugs":{"url":"https://github.com/35up/http-client/issues"},"dist":{"shasum":"21d29a014041893c42f810caab50a5d20974578f","tarball":"https://registry.npmjs.org/@35up/http-client/-/http-client-2.2.0.tgz","fileCount":19,"integrity":"sha512-LvjLYz6luufWji1csrDnJX8KGPxZdfml0ZVOu6wPsUzuad6cHLGPqke4xUJtyhQ9YsQRbIGfiUSsYHTbS+bXqA==","signatures":[{"sig":"MEYCIQC5F8E98Jzy81e7HTvMl3D6G+2Qh8soKwK/lw9OOe921wIhAMWKV16G8f0XU/7fYdX73iBMGtMjsa7EGwWVXEf/Kqm9","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":73295,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkLUN5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmowQA/6Alvh0o8mdzgSZGT5EW40ZOHZjZGFxV2jWooNRlv4UuL6j9sB\r\nIJJ7HPh3ldXmXzCojfHGKwAMWmSaXoDSXSJBb5AlJe6ApDsS8MmghLw7Ul+N\r\nN1625NpIXKiuMkS2sNtwiJcmSOFPF4Vs/gonv08B1SmCx6S3C70CPAiij9aT\r\nqLQBet09bauavB6UKuL5c/cIKNO+MrbSV5v+fnTTFQUrdgb/gzHyf/fLA4Ko\r\nzvEHSMnlLYp/2J5dmKvC1KymHfIOrJn5XfCrbeUPrUu46yFktmfynZ4FrIJU\r\nDXT2mJu6cCRZQKkQ0lUEzd/liRff2y4LFvsGET4MMWP/rnqgh6NusNCg5BtU\r\njtN4NZ0XclXwPIToGWou1c5S548nDg8Aa3cbOnATJxs6w2r7NFqx5WRmvNRP\r\nb3HH5m8Ypk77zHhJorzCGXq6YbXDF00/tKrw0XV6XAPv5lRPgrvuZfvwikP8\r\nSk8SQY/AP4qLKj6MBcTmrFvwZPQNfd/icGHzMJFTDeNpSOyu7aKCq9oZIJSb\r\nDepBH7BfkDJPX3jcNmYak5Hb56lHxf5n8HPF0PUDsAhMY/gR8Xi4Vb7BJpzx\r\nRh54FDaFxH94A3YvqMndbd1TbWLyx/Bxr1g6VCmrloHmjQPjfauQj8Ja7jqj\r\nlS5zBuEldrrMnsNSwBOfv3qw2UVrf0eomQk=\r\n=u5NY\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/http-client.node.cjs","type":"module","types":"./dist/http-client.node.d.ts","module":"dist/http-client.js","exports":{"import":{"node":"./dist/http-client.node.js","default":"./dist/http-client.js"},"require":{"node":"./dist/http-client.node.cjs","default":"./dist/http-client.cjs"}},"gitHead":"84b3ba9b9740ddc22b0e60a3d02178dd2a4b6974","scripts":{"ci":"npm i && npm run build && npm run lint && npm run test","lint":"eslint --ext .ts,.js .","test":"jest --passWithNoTests","build":"rollup --config","test:ci":"npm test -- --ci --forceExit --runInBand","test:watch":"npm run test -- --watch","test:coverage":"npm test -- --ci --json --coverage --testLocationInResults --outputFile=coverage/report.json","prepublishOnly":"npm i && npm run build && npm run lint && npm run test"},"_npmUser":{"name":"enjoythelive1","email":"enjoythelive1@gmail.com"},"repository":{"url":"git+https://github.com/35up/http-client.git","type":"git"},"_npmVersion":"8.19.2","description":"Provides convenient apis to make http requests and handle the responses,  eliminates boilerplate code. It is basically a wrapper over XHR requests  (uses fetch).","directories":{},"_nodeVersion":"19.8.1","dependencies":{"node-fetch":"^2.6.7","@types/node-fetch":"^2.6.2"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.2.0","jest":"^26.6.3","sinon":"^11.1.2","tslib":"^2.4.1","eslint":"^8.22.0","rollup":"^2.33.1","core-js":"^3.7.0","sinon-chai":"^3.7.0","typescript":"^4.8.4","@babel/core":"^7.12.1","@types/chai":"^4.2.0","@types/jest":"^26.0.15","jest-fetch-mock":"^3.0.3","ts-mock-imports":"^1.3.0","@babel/preset-env":"^7.12.1","@types/sinon-chai":"^3.2.5","rollup-plugin-dts":"^4.2.2","@babel/preset-typescript":"^7.12.1","@rollup/plugin-typescript":"^8.5.0","@35up/eslint-config-35up-base":"^4.0.0","babel-plugin-transform-async-to-promises":"^0.8.15"},"_npmOperationalInternal":{"tmp":"tmp/http-client_2.2.0_1680687993220_0.5529064642355725","host":"s3://npm-registry-packages"}},"2.3.0":{"name":"@35up/http-client","version":"2.3.0","keywords":["http","client"],"author":{"name":"35up GmbH","email":"the.engineers@35up.com"},"license":"MIT","_id":"@35up/http-client@2.3.0","maintainers":[{"name":"enjoythelive1","email":"enjoythelive1@gmail.com"},{"name":"drafter500","email":"vzemtsov@yahoo.com"},{"name":"schrodervictor","email":"schrodervictor@gmail.com"},{"name":"35up-npm","email":"npm@35up.com"}],"homepage":"https://github.com/35up/http-client#readme","bugs":{"url":"https://github.com/35up/http-client/issues"},"dist":{"shasum":"a8485e2bffb53bc697ab16996a9aeeb2daa7be62","tarball":"https://registry.npmjs.org/@35up/http-client/-/http-client-2.3.0.tgz","fileCount":19,"integrity":"sha512-HdZpVMPIIqoYsZLE2C7MI7tJiYugr9Q3PCHv/aIsciFxAuP3T+09Vwehz/H0aoaHs9CHrn/vTDmluKwr+jRIjg==","signatures":[{"sig":"MEQCIAHAVxcroYP2j5dNKoKgpgoe07ybou9YGGkbFh4zwKYCAiBbA0Cob0NMR0hJiUc4WOZj3TG7vkOM4LE7ONF1W0E6hQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":40788},"main":"dist/http-client.node.cjs","type":"module","types":"./dist/http-client.node.d.ts","module":"dist/http-client.js","engines":{"node":">18"},"exports":{"import":{"node":"./dist/http-client.node.js","default":"./dist/http-client.js"},"require":{"node":"./dist/http-client.node.cjs","default":"./dist/http-client.cjs"}},"gitHead":"cb26d66ca86c3fcc0320d3c38f97fbea5ea43f86","scripts":{"ci":"npm i && npm run build && npm run lint && npm run test","lint":"eslint --ext .ts,.js .","test":"jest --passWithNoTests","build":"rollup --config","test:ci":"npm test -- --ci --forceExit --runInBand","test:watch":"npm run test -- --watch","test:coverage":"npm test -- --ci --json --coverage --testLocationInResults --outputFile=coverage/report.json","prepublishOnly":"npm i && npm run build && npm run lint && npm run test"},"_npmUser":{"name":"drafter500","email":"vzemtsov@yahoo.com"},"repository":{"url":"git+https://github.com/35up/http-client.git","type":"git"},"_npmVersion":"10.2.3","description":"Provides convenient apis to make http requests and handle the responses,  eliminates boilerplate code. It is basically a wrapper over XHR requests  (uses fetch).","directories":{},"_nodeVersion":"20.10.0","dependencies":{"tslib":"^2.4.1","node-fetch":"^2.6.7"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.2.0","jest":"^26.6.3","sinon":"^11.1.2","eslint":"^8.22.0","rollup":"^2.33.1","core-js":"^3.7.0","sinon-chai":"^3.7.0","typescript":"^4.8.4","@babel/core":"^7.12.1","@types/chai":"^4.2.0","@types/jest":"^26.0.15","jest-fetch-mock":"^3.0.3","ts-mock-imports":"^1.3.0","@babel/preset-env":"^7.12.1","@types/node-fetch":"^2.6.2","@types/sinon-chai":"^3.2.5","rollup-plugin-dts":"^4.2.2","@babel/preset-typescript":"^7.12.1","@rollup/plugin-typescript":"^8.5.0","@35up/eslint-config-35up-base":"^4.0.0","babel-plugin-transform-async-to-promises":"^0.8.15"},"_npmOperationalInternal":{"tmp":"tmp/http-client_2.3.0_1726241601185_0.15647682676834274","host":"s3://npm-registry-packages"}},"2.3.1":{"name":"@35up/http-client","version":"2.3.1","keywords":["http","client"],"author":{"name":"35up GmbH","email":"the.engineers@35up.com"},"license":"MIT","_id":"@35up/http-client@2.3.1","maintainers":[{"name":"35up-npm","email":"npm@35up.com"},{"name":"schrodervictor","email":"schrodervictor@gmail.com"},{"name":"drafter500","email":"vzemtsov@yahoo.com"}],"homepage":"https://github.com/35up/http-client#readme","bugs":{"url":"https://github.com/35up/http-client/issues"},"dist":{"shasum":"337984eb1fdbe716d99b3b860a8c79b772786c8a","tarball":"https://registry.npmjs.org/@35up/http-client/-/http-client-2.3.1.tgz","fileCount":19,"integrity":"sha512-snTF5/OLnm1wIIQZyOt9/MTRNbj59W231xRVYg/TZT/hYjqhVfZx+cwExQvN6/vpIxM12sz9hPudig+qKIKIZw==","signatures":[{"sig":"MEUCIBYDJ5lauYXbcFlUgUXUXGBBWbrZOZDEhFYcz/H7BDcdAiEAn7zyuugYYjOTWOzvlKnip9so22llXKFTc2vJ2Ybw3J4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":41144},"main":"dist/http-client.node.cjs","type":"module","types":"./dist/http-client.node.d.ts","module":"dist/http-client.js","engines":{"node":">18"},"exports":{"import":{"node":"./dist/http-client.node.js","default":"./dist/http-client.js"},"require":{"node":"./dist/http-client.node.cjs","default":"./dist/http-client.cjs"}},"gitHead":"1816325aa1cac799a02333e554a745cc21049b76","scripts":{"ci":"npm i && npm run build && npm run lint && npm run test","lint":"eslint --ext .ts,.js .","test":"jest --passWithNoTests","build":"rollup --config","test:ci":"npm test -- --ci --forceExit --runInBand","test:watch":"npm run test -- --watch","test:coverage":"npm test -- --ci --json --coverage --testLocationInResults --outputFile=coverage/report.json","prepublishOnly":"npm i && npm run build && npm run lint && npm run test"},"_npmUser":{"name":"drafter500","email":"vzemtsov@yahoo.com"},"repository":{"url":"git+https://github.com/35up/http-client.git","type":"git"},"_npmVersion":"11.6.2","description":"Provides convenient apis to make http requests and handle the responses,  eliminates boilerplate code. It is basically a wrapper over XHR requests  (uses fetch).","directories":{},"_nodeVersion":"24.11.1","dependencies":{"tslib":"^2.4.1","node-fetch":"^2.6.7"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.2.0","jest":"^26.6.3","sinon":"^11.1.2","eslint":"^8.22.0","rollup":"^2.33.1","core-js":"^3.7.0","sinon-chai":"^3.7.0","typescript":"^4.8.4","@babel/core":"^7.12.1","@types/chai":"^4.2.0","@types/jest":"^26.0.15","jest-fetch-mock":"^3.0.3","ts-mock-imports":"^1.3.0","@babel/preset-env":"^7.12.1","@types/node-fetch":"^2.6.2","@types/sinon-chai":"^3.2.5","rollup-plugin-dts":"^4.2.2","@babel/preset-typescript":"^7.12.1","@rollup/plugin-typescript":"^8.5.0","@35up/eslint-config-35up-base":"^4.0.0","babel-plugin-transform-async-to-promises":"^0.8.15"},"_npmOperationalInternal":{"tmp":"tmp/http-client_2.3.1_1771255409625_0.9292747673816124","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2023-03-30T14:38:14.636Z","modified":"2026-04-01T20:19:16.219Z","2.1.6":"2023-03-30T14:38:14.912Z","2.2.0":"2023-04-05T09:46:33.424Z","2.3.0":"2024-09-13T15:33:21.320Z","2.3.1":"2026-02-16T15:23:29.789Z"},"bugs":{"url":"https://github.com/35up/http-client/issues"},"author":{"name":"35up GmbH","email":"the.engineers@35up.com"},"license":"MIT","homepage":"https://github.com/35up/http-client#readme","keywords":["http","client"],"repository":{"url":"git+https://github.com/35up/http-client.git","type":"git"},"description":"Provides convenient apis to make http requests and handle the responses,  eliminates boilerplate code. It is basically a wrapper over XHR requests  (uses fetch).","maintainers":[{"email":"npm@35up.com","name":"35up-npm"},{"email":"vzemtsov@yahoo.com","name":"drafter500"}],"readme":"# http-client\n\nProvides convenient apis to make http requests and handle the responses, \neliminates boilerplate code. It is basically a wrapper over XHR requests \n(uses fetch).\n\n## APIs\nThe main API of the library is `createMethod`. This creates a ready to use \nfunction with some settings already embedded into it. \n\n```\ncreateMethod(method, baseUrl, defaultOptions)\n```\n\nParams:\n\n| Parameter      | Description                                                                                                             | Type   | Required |\n|----------------|-------------------------------------------------------------------------------------------------------------------------|--------|----------|\n| method         | HTTP method: `GET`, `POST`, `PUT`, etc.                                                                                 | String | Yes      |\n| baseUrl        | Base url of the request path (will be prefixed the final url). When not specified <br/> relative path will be used `/`  | String | No       |\n| defaultOptions | Request options that will be used by default. See details below                                                         | Object | No       |\n\nOptions:\n\n| Parameter       | Description                                                                                    | Type    | Required |\n|-----------------|------------------------------------------------------------------------------------------------|---------|----------|\n| headers         | Extra headers you would like to pass                                                           | Object  | No       |\n| withCredentials | Flag whether to include cookies in the request (defaults to `false`)                           | Boolean | No       |\n| mode            | Request mode                                                                                   | String  | No       |\n| params          | Search params object. Will be trasnformed to query string and <br/>appended to the request url | Object  | No       |\n\n`createMethod` returns a function with the following signature:\n```\nmethod(endpointUrl, body, options)\n```\n\nParameters:\n\n| Parameter   | Description                                                                                             | Type   | Required |\n|-------------|---------------------------------------------------------------------------------------------------------|--------|----------|\n| endpointUrl | The request endpoint. Will be appended to the baseUrl                                                   | String | Yes      |\n| body        | Request body                                                                                            | Object | No       |\n| options     | Request options. See details above. This will be merged with defaultOptions specified at `createMethod` | Object | No       |\n\n\n### Example\n```  \n  import { createMethod } from '@35up/http-client';\n  \n  const put = createMethod(\n    'PUT',\n    'https://my-website/apis/v1',\n    {\n      withCredentials: true, \n      headers: {'Content-Type': 'application/octet-stream'},\n    },\n   );\n   \n  // And then just use it to make an http request\n  const result = await put('/order', {sku: '12345'}, {mode: 'cors'});\n```\nThe returned value is a promise with decoded response body.\n\nIn case response fails, method throws an exception of type `HttpError`\n\n`HttpError` inherits from `Error` class and has the following extra properties:\n\n| Property           | Description                                     | Type   |\n|--------------------|-------------------------------------------------|--------|\n| responseStatus     | Status code (404, 500, etc.)                    | Number |\n| responseStatusText | Status text (i.e. internal server error)        | String |\n| data               | Reponse data. This may contain arbitrary object | Object |\n\n\n### Checking if thrown exception is of type HttpError\n\nThis is possible with `isHttpError` utility:\n```\n  try {\n    ...\n    await method(...);\n  } catch(e) {\n    if (isHttpError(e)) {\n      // ... An http error happened. handle it here\n    }\n    // Some other issue occured, deal with it in other way\n  }\n```\n\n### Shortcuts \n\nThe library also exposes ready to use methods that do not have a base url so \nyou could bypass calling `createMethod` in case your api base url is the same \nas your website (using relative path):\n```\n  import { get } from '@35up/http-client';\n  \n  const result = await get('/api/v1/orders');\n```\n\nThe available functions are: \n`get`, `post`, `put`, `patch`, `deleteMethod`, `head`;\n\n## Requirements\n\nThe library supports both browser and node environments.\n\nHttp-client depends on the [Fetch API]. If you support older browsers which may\nnot yet provide these natively (e.g. IE), consider including a global polyfill\nin your bundled application, such as [fetch].\n\n\n<!-- LINKS -->\n\n[Fetch API]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API\n[fetch]: https://github.com/github/fetch\n","readmeFilename":"README.md"}