{"_id":"@financial-times/ip-wxp-fetch-wrapper","_rev":"35-b90145095f1beb8e0c4ce6e07c54b27e","name":"@financial-times/ip-wxp-fetch-wrapper","dist-tags":{"latest":"1.0.2"},"versions":{"0.0.1":{"name":"@financial-times/ip-wxp-fetch-wrapper","version":"0.0.1","author":{"name":"Internal Products","email":"ip.engineering@ft.com"},"license":"ISC","_id":"@financial-times/ip-wxp-fetch-wrapper@0.0.1","maintainers":[{"name":"aendrew","email":"aendrew@aendrew.com"},{"name":"bobhaslett","email":"bob.haslett@ft.com"},{"name":"callumlocke","email":"callum.locke@gmail.com"},{"name":"ft-internal-products","email":"ip.engineering@ft.com"},{"name":"i-like-robots","email":"matt+npm@maketea.co.uk"},{"name":"jakedchampion","email":"me@jakechampion.name"},{"name":"joannaskao","email":"joannaskao@gmail.com"},{"name":"mattandrews","email":"matt@mattandre.ws"},{"name":"quarterto","email":"mwr.brennan@gmail.com"},{"name":"robinmarr-ft","email":"robin.marr@ft.com"},{"name":"rowanmanning","email":"accounts@rowanmanning.co.uk"},{"name":"sdbernard","email":"steve.bernard@ft.com"},{"name":"the-ft","email":"strategic.products+npm@ft.com"}],"contributors":[{"name":"Robin Marr","email":"robin.marr@ft.com"},{"name":"Kiya Gurmesa","email":"kiya.gurmesa@ft.com"},{"name":"Teja Thomas","email":"teja.thomas@ft.com"}],"homepage":"https://github.com/financial-times/ip-wxp-fetch-wrapper#readme","bugs":{"url":"https://github.com/financial-times/ip-wxp-fetch-wrapper/issues"},"nyc":{"exclude":["**/*.(spec|fixture).js"],"reporter":["html","lcov","text-summary"]},"dist":{"shasum":"68f2aaf1e3c2e8bb4abf81f4a606e1d4fcc40694","tarball":"https://registry.npmjs.org/@financial-times/ip-wxp-fetch-wrapper/-/ip-wxp-fetch-wrapper-0.0.1.tgz","fileCount":5,"integrity":"sha512-zTFW7MNu2JOaXoPvfbUa7LmTU/yaaKPiYdYnqwjkwBVfTupr0WXs+MYW3RetQmSsMzOyfMDkU/UI7vLh9PP5WQ==","signatures":[{"sig":"MEUCIQCpVwWJoq1wbbpAD0H6GXqkd6LFlfJWi5J50j9NjwAcRAIgSnY9UTJ6k7eMxTTQvVkomqzXbxYGwWr35RkcFaKafug=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11138},"main":"index.js","team":"internal-products","babel":{"plugins":["@babel/plugin-proposal-object-rest-spread"],"presets":[["@babel/preset-env",{"targets":{"node":"8.10.0"}}]],"retainLines":true},"gitHead":"cd6f1500d04b44ac0888e94cc9940cae867ce4c2","scripts":{"lint":"eslint --ignore-path=./.gitignore .","test":"run-s lint mocha:report","mocha":"NODE_ENV=test mocha --recursive './{,!(node_modules)/**/}*.spec.js'","prepush":"npm test","commitmsg":"secret-squirrel-commitmsg","precommit":"secret-squirrel","preversion":"test $(git rev-parse --abbrev-ref HEAD) != 'master' && { echo 'you must be on master to release'; exit 1; } || exit 0","mocha:debug":"npm run mocha -- --inspect-brk=9229 --no-timeouts","mocha:watch":"npm run mocha -- --watch","postversion":"git push origin master --tags","mocha:report":"nyc --report-dir ./coverage/ npm run mocha -- --reporter mocha-multi-reporters --reporter-options configFile=./test/reporters.json"},"_npmUser":{"name":"ft-internal-products","email":"ip.engineering@ft.com"},"repository":{"url":"git+https://github.com/financial-times/ip-wxp-fetch-wrapper.git","type":"git"},"_npmVersion":"5.6.0","description":"A small wrapper around fetch that throws custom http errors","directories":{},"_nodeVersion":"8.10.0","dependencies":{"lodash":"^4.17.5","urljoin":"^0.1.5","isomorphic-fetch":"^2.2.1"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^11.6.0","chai":"^4.1.2","husky":"^0.14.3","mocha":"^5.0.5","sinon":"^4.5.0","eslint":"^4.19.1","sinon-chai":"^3.0.0","@babel/core":"^7.0.0-beta.44","chai-string":"^1.4.0","mochawesome":"^3.0.2","npm-run-all":"^4.1.2","@babel/polyfill":"^7.0.0-beta.44","@babel/register":"^7.0.0-beta.44","@babel/preset-env":"^7.0.0-beta.44","mocha-junit-reporter":"^1.17.0","mocha-multi-reporters":"^1.1.7","@financial-times/secret-squirrel":"^2.8.0","@babel/plugin-proposal-object-rest-spread":"^7.0.0-beta.44"},"_npmOperationalInternal":{"tmp":"tmp/ip-wxp-fetch-wrapper_0.0.1_1522837206763_0.3265100076327545","host":"s3://npm-registry-packages"}},"1.0.0":{"name":"@financial-times/ip-wxp-fetch-wrapper","version":"1.0.0","author":{"name":"Internal Products","email":"ip.engineering@ft.com"},"license":"ISC","_id":"@financial-times/ip-wxp-fetch-wrapper@1.0.0","maintainers":[{"name":"aendrew","email":"aendrew@aendrew.com"},{"name":"bobhaslett","email":"bob.haslett@ft.com"},{"name":"callumlocke","email":"callum.locke@gmail.com"},{"name":"ft-internal-products","email":"ip.engineering@ft.com"},{"name":"i-like-robots","email":"matt+npm@maketea.co.uk"},{"name":"jakedchampion","email":"me@jakechampion.name"},{"name":"joannaskao","email":"joannaskao@gmail.com"},{"name":"mattandrews","email":"matt@mattandre.ws"},{"name":"quarterto","email":"mwr.brennan@gmail.com"},{"name":"robinmarr-ft","email":"robin.marr@ft.com"},{"name":"rowanmanning","email":"accounts@rowanmanning.co.uk"},{"name":"sdbernard","email":"steve.bernard@ft.com"},{"name":"the-ft","email":"strategic.products+npm@ft.com"},{"name":"zhenyulin","email":"zhenyu.lyn@gmail.com"}],"contributors":[{"name":"Robin Marr","email":"robin.marr@ft.com"},{"name":"Kiya Gurmesa","email":"kiya.gurmesa@ft.com"},{"name":"Teja Thomas","email":"teja.thomas@ft.com"}],"homepage":"https://github.com/financial-times/ip-wxp-fetch-wrapper#readme","bugs":{"url":"https://github.com/financial-times/ip-wxp-fetch-wrapper/issues"},"nyc":{"exclude":["**/*.(spec|fixture).js"],"reporter":["html","lcov","text-summary"]},"dist":{"shasum":"872ce818e0449bd708fc8768e31ea479aaba284b","tarball":"https://registry.npmjs.org/@financial-times/ip-wxp-fetch-wrapper/-/ip-wxp-fetch-wrapper-1.0.0.tgz","fileCount":5,"integrity":"sha512-enwM3pjmbsno6Eygxf0vgKU1ru7hU0GSsaBgKKAGgLsZVcu2OZ+vhFh1tL7VVYK4FCOHHNvW6jHBFLrXQiCxMQ==","signatures":[{"sig":"MEUCIQD+CneMrML5lcFvOHjgzdrA7eyxZg7NcwMEXapif+bFjgIgMedoedPAQaqeb0X0BmTs95+JAatcCANMl/c8Vdp6ys8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11408},"main":"index.js","team":"internal-products","babel":{"plugins":["@babel/plugin-proposal-object-rest-spread"],"presets":[["@babel/preset-env",{"targets":{"node":"8.10.0"}}]],"retainLines":true},"gitHead":"0fa931630051c1af2c85fc53b010a31535619b64","scripts":{"lint":"eslint --ignore-path=./.gitignore .","test":"run-s lint mocha:report","mocha":"NODE_ENV=test mocha --recursive './{,!(node_modules)/**/}*.spec.js'","prepush":"npm test","commitmsg":"secret-squirrel-commitmsg","precommit":"secret-squirrel","preversion":"test $(git rev-parse --abbrev-ref HEAD) != 'master' && { echo 'you must be on master to release'; exit 1; } || exit 0","mocha:debug":"npm run mocha -- --inspect-brk=9229 --no-timeouts","mocha:watch":"npm run mocha -- --watch","postversion":"git push origin master --tags","whitesource":"whitesource \"$npm_package_name\"","mocha:report":"nyc --report-dir ./coverage/ npm run mocha -- --reporter mocha-multi-reporters --reporter-options configFile=./test/reporters.json"},"_npmUser":{"name":"ft-internal-products","email":"ip.engineering@ft.com"},"repository":{"url":"git+https://github.com/financial-times/ip-wxp-fetch-wrapper.git","type":"git"},"_npmVersion":"5.6.0","description":"A small wrapper around fetch that throws custom http errors","directories":{},"_nodeVersion":"8.10.0","dependencies":{"lodash":"^4.17.5","urljoin":"^0.1.5","isomorphic-fetch":"^2.2.1"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^11.6.0","chai":"^4.1.2","husky":"^0.14.3","mocha":"^5.0.5","sinon":"^4.5.0","eslint":"^4.19.1","sinon-chai":"^3.0.0","@babel/core":"^7.0.0-beta.44","chai-string":"^1.4.0","mochawesome":"^3.0.2","npm-run-all":"^4.1.2","@babel/polyfill":"^7.0.0-beta.44","@babel/register":"^7.0.0-beta.44","@babel/preset-env":"^7.0.0-beta.44","mocha-junit-reporter":"^1.17.0","mocha-multi-reporters":"^1.1.7","@financial-times/di2-whitesource":"^2.0.0","@financial-times/secret-squirrel":"^2.8.0","@babel/plugin-proposal-object-rest-spread":"^7.0.0-beta.44"},"_npmOperationalInternal":{"tmp":"tmp/ip-wxp-fetch-wrapper_1.0.0_1523027697806_0.7399667260225551","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@financial-times/ip-wxp-fetch-wrapper","version":"1.0.1","author":{"name":"Internal Products","email":"ip.engineering@ft.com"},"license":"ISC","_id":"@financial-times/ip-wxp-fetch-wrapper@1.0.1","maintainers":[{"name":"aendrew","email":"aendrew@aendrew.com"},{"name":"bobhaslett","email":"bob.haslett@ft.com"},{"name":"callumlocke","email":"callum.locke@gmail.com"},{"name":"ft-internal-products","email":"ip.engineering@ft.com"},{"name":"i-like-robots","email":"matt+npm@maketea.co.uk"},{"name":"jakedchampion","email":"me@jakechampion.name"},{"name":"joannaskao","email":"joannaskao@gmail.com"},{"name":"mattandrews","email":"matt@mattandre.ws"},{"name":"quarterto","email":"mwr.brennan@gmail.com"},{"name":"robinmarr-ft","email":"robin.marr@ft.com"},{"name":"rowanmanning","email":"accounts@rowanmanning.co.uk"},{"name":"sdbernard","email":"steve.bernard@ft.com"},{"name":"the-ft","email":"strategic.products+npm@ft.com"},{"name":"zhenyulin","email":"zhenyu.lyn@gmail.com"}],"contributors":[{"name":"Robin Marr","email":"robin.marr@ft.com"},{"name":"Kiya Gurmesa","email":"kiya.gurmesa@ft.com"},{"name":"Teja Thomas","email":"teja.thomas@ft.com"}],"homepage":"https://github.com/financial-times/ip-wxp-fetch-wrapper#readme","bugs":{"url":"https://github.com/financial-times/ip-wxp-fetch-wrapper/issues"},"nyc":{"exclude":["**/*.(spec|fixture).js"],"reporter":["html","lcov","text-summary"]},"dist":{"shasum":"53efe078895f8213888c0cff1fa7f2d8b346cd6a","tarball":"https://registry.npmjs.org/@financial-times/ip-wxp-fetch-wrapper/-/ip-wxp-fetch-wrapper-1.0.1.tgz","fileCount":5,"integrity":"sha512-ulRaeXAACxMy0xAt1u0KYovDA25BQWNwLOdkrzX8GQhscrs0lcBzC1vC/DO66scwOaZOUZ7dl6lEmzJS786qjw==","signatures":[{"sig":"MEYCIQCP/j7VqUWQNRkUqDOsPlWWApboko1NCRPOBJsVoGfQngIhALkILpDbYEWhh9jhhLGYZNXZAiMVtZ3Klkz/0yR7mTke","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10992,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbEBRnCRA9TVsSAnZWagAAJu0P/jFcvamrn5q+RVnWG2UP\nxVQcMo4q+QP0y2eJIr3+DZfmLnMMpyKRQmOOrUL/MkSIsce99Oxgzcj1AiQ1\nrvYCkv7bMVeMloQqz0+ZSofRFxyO54xfaz0zaCEGGbyAAeZ0D5iLfkbcmaMg\nzPB1udGZkX0wl5t5a2TR3wYV+QE+6pNKTglcJPmXCGzQCu5EUXVeD8sLOVQ8\n9NsuZUrWQ6PRNIRPqeKx3Kx5M0vWaS67T7zAzZ3KRNqsWklbfvSx6IjAMVOl\noelHskfpwEITfhPRwXu2QeUxcK4DEl39upXgZUOg4LTR5QZCsqNqdffDEQ1u\nxG3/1y6MYmxZfW67svzRWAX7ihRfN4+1VNrYasIG/+/JK4vAlPFYKGQtpteA\nn/bG6AKLLzAy6pMXq/vea5IuF+17EvUj/OYhY4b0oEtv83dgAPZP5j5fuvCZ\nEeU8XbdXb253mD9LWR3AGq+MtGcaKk+gOo3A7Cp0SFxgSz1K5kPYO1oSUjP9\nsjUYv4a5MoVFMSwPDiJuGb7yrl2Y9C/1clGU4+tPFHKzW4NIz4kRJI7knf+8\n0ICyBX2j6qdCedoqx+vauZVLxaXksGYDaJkEsfvtXWMix5tcAATZJ6CtvP2X\nmSetsRx2/CCYiPsc/NlLNEo5QrUrIFIdeWJdSwnKYDgBNjwjlisNYaoPCcpE\n358R\r\n=exf5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","team":"internal-products","babel":{"presets":["@financial-times/ip-wxp"]},"gitHead":"5b834606272b2e9a1616f69fdd04dc76ff9cd9ea","scripts":{"lint":"ip lint","test":"run-s lint \"mocha -- --report\"","mocha":"ip mocha","preversion":"test $(git rev-parse --abbrev-ref HEAD) != 'master' && { echo 'you must be on master to release'; exit 1; } || exit 0","postinstall":"(pwd | grep -q 'node_modules' || test \"$NODE_ENV\" = 'production') && exit 0 || ip postinstall","postversion":"git push origin master --tags","whitesource":"whitesource \"$npm_package_name\""},"_npmUser":{"name":"ft-internal-products","email":"ip.engineering@ft.com"},"repository":{"url":"git+https://github.com/financial-times/ip-wxp-fetch-wrapper.git","type":"git"},"_npmVersion":"5.6.0","description":"A small wrapper around fetch that throws custom http errors","directories":{},"_nodeVersion":"8.11.2","dependencies":{"debug":"^3.1.0","lodash":"^4.17.5","urljoin":"^0.1.5","isomorphic-fetch":"^2.2.1"},"eslintConfig":{"extends":["@financial-times/ip-wxp"]},"_hasShrinkwrap":false,"devDependencies":{"npm-run-all":"^4.1.2","@babel/preset-env":"^7.0.0-beta.49","@financial-times/ip-wxp-scripts":"^1.0.4","@financial-times/di2-whitesource":"^2.0.1","@financial-times/secret-squirrel":"^2.8.0","@financial-times/ip-wxp-git-config":"0.0.2","@financial-times/babel-preset-ip-wxp":"^1.0.2","@financial-times/eslint-config-ip-wxp":"^1.0.4"},"_npmOperationalInternal":{"tmp":"tmp/ip-wxp-fetch-wrapper_1.0.1_1527780454789_0.9616415994251564","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@financial-times/ip-wxp-fetch-wrapper","version":"1.0.2","author":{"name":"Internal Products","email":"ip.engineering@ft.com"},"license":"ISC","_id":"@financial-times/ip-wxp-fetch-wrapper@1.0.2","maintainers":[{"name":"aendrew","email":"aendrew@aendrew.com"},{"name":"bobhaslett","email":"bob.haslett@ft.com"},{"name":"callumlocke","email":"callum.locke@gmail.com"},{"name":"ft-internal-products","email":"ip.engineering@ft.com"},{"name":"i-like-robots","email":"matt+npm@maketea.co.uk"},{"name":"jakedchampion","email":"me@jakechampion.name"},{"name":"joannaskao","email":"joannaskao@gmail.com"},{"name":"mattandrews","email":"matt@mattandre.ws"},{"name":"quarterto","email":"mwr.brennan@gmail.com"},{"name":"robinmarr-ft","email":"robin.marr@ft.com"},{"name":"rowanmanning","email":"accounts@rowanmanning.co.uk"},{"name":"sdbernard","email":"steve.bernard@ft.com"},{"name":"the-ft","email":"strategic.products+npm@ft.com"},{"name":"zhenyulin","email":"zhenyu.lyn@gmail.com"}],"contributors":[{"name":"Robin Marr","email":"robin.marr@ft.com"},{"name":"Kiya Gurmesa","email":"kiya.gurmesa@ft.com"},{"name":"Teja Thomas","email":"teja.thomas@ft.com"}],"homepage":"https://github.com/financial-times/ip-wxp-fetch-wrapper#readme","bugs":{"url":"https://github.com/financial-times/ip-wxp-fetch-wrapper/issues"},"nyc":{"exclude":["**/*.(spec|fixture).js"],"reporter":["html","lcov","text-summary"]},"dist":{"shasum":"f5cbb925e46de4b1a9a4d2bfe0553a73ad1aa477","tarball":"https://registry.npmjs.org/@financial-times/ip-wxp-fetch-wrapper/-/ip-wxp-fetch-wrapper-1.0.2.tgz","fileCount":4,"integrity":"sha512-r452EFks+PON8TafDN7y+bzsD0q1whFglC0/Y4yCtNqACy5Wn/Hkr6+RTdGtLWTTOGLF7dtZv1Hy+mfIcaqPzg==","signatures":[{"sig":"MEUCIQD+MW5mWgIE7HHuDBT1GjpSk84tVbYIRZl0cVjGiVopwQIgF4XQaPm7wKpop+ZFRXkKLAQ3T+6/ZtqXNaBa+NuxzQw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":7934,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2HCwCRA9TVsSAnZWagAAAWUP/j81ElhNMJcLJugNVe37\nF2SjY7rVmBa3cNpuF/LHVYY/YFK0H1iBZ7uVuPeJ1rD3elrR1gk9p7xnAoqD\nCOAWQ5+q4KHEFpKMlxYmwO/RuQGCAcld+9SBr/lrVnPz0JVGiTrM+4Ngmu04\nCByRPDJi6ih7U4qjQEhs77Vl2LIaljttydnsFd0WCMZBCtIvi/We+nmTTL/f\n/rQT6Jjr41OGuqkzTIiASDsROi9nZUrds0TUKqHekW7gTogRj1RC6745qw+u\n5h0UEZ/MF669B6tKrt57LvYPI21SFRctKIIWKQmnIyTzgvt9CXB7Me8W774G\n8MQcjX+duwEHwNvXjVDi+xEncKGiwP1mxTRzwCb8xzJBIUAj3PTw7k8BLUV7\nG6+TfxVwRlmUuJU21aPu6fqWb9V0f1rYtpDFwfYSy40TKiBEzVfF1z5RjYx7\n03LX5JJExlvgVN+oxHzU1UgG4uOxcWzos4ACfB+vyp/9fxxAiFbsU+CjBY6I\nZE2XcQtp73KBDI8TXj36vv83wmXnQpjKMftkagYg7/7Dm601YksBdgwU5OQr\nw7QVfZIrSO4HhEjFDlItq+eSBYlJjR246LdUDTynRa0ZnPDQvc4QDDXbMGNI\nOC+m66/nK031PRhUzriOhyTTuDOVoZ/eLTqspE1Kzy/CPJk33B3D0gyx6FK5\ni3Fj\r\n=kH2g\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","team":"internal-products","babel":{"presets":["@financial-times/ip-wxp"]},"gitHead":"4103c88b73637c6083089e5c898c5ac923923922","scripts":{"lint":"ip lint","test":"run-s lint \"mocha -- --report\"","mocha":"ip mocha","preversion":"test $(git rev-parse --abbrev-ref HEAD) != 'master' && { echo 'you must be on master to release'; exit 1; } || exit 0","postinstall":"(pwd | grep -q 'node_modules' || test \"$NODE_ENV\" = 'production') && exit 0 || ip postinstall","postversion":"git push origin master --tags","whitesource":"whitesource \"$npm_package_name\""},"_npmUser":{"name":"ft-internal-products","email":"ip.engineering@ft.com"},"repository":{"url":"git+https://github.com/financial-times/ip-wxp-fetch-wrapper.git","type":"git"},"_npmVersion":"5.6.0","description":"A small wrapper around fetch that throws custom http errors","directories":{},"_nodeVersion":"8.11.2","dependencies":{"debug":"^3.1.0","lodash":"^4.17.5","urljoin":"^0.1.5","isomorphic-fetch":"^2.2.1","@financial-times/ip-custom-errors":"^1.0.1"},"eslintConfig":{"extends":["@financial-times/ip-wxp"]},"_hasShrinkwrap":false,"devDependencies":{"npm-run-all":"^4.1.2","@babel/preset-env":"^7.0.0-beta.49","@financial-times/ip-wxp-scripts":"^1.0.4","@financial-times/di2-whitesource":"^2.0.1","@financial-times/secret-squirrel":"^2.8.0","@financial-times/ip-wxp-git-config":"1.0.0","@financial-times/babel-preset-ip-wxp":"^1.0.3","@financial-times/eslint-config-ip-wxp":"^1.0.5"},"_npmOperationalInternal":{"tmp":"tmp/ip-wxp-fetch-wrapper_1.0.2_1527861960359_0.5619245760845928","host":"s3://npm-registry-packages"}}},"time":{"created":"2018-04-04T10:20:06.709Z","modified":"2026-06-23T16:02:09.231Z","0.0.1":"2018-04-04T10:20:07.199Z","1.0.0":"2018-04-06T15:14:57.948Z","1.0.1":"2018-05-31T15:27:34.837Z","1.0.2":"2018-06-01T14:06:00.952Z"},"bugs":{"url":"https://github.com/financial-times/ip-wxp-fetch-wrapper/issues"},"author":{"name":"Internal Products","email":"ip.engineering@ft.com"},"license":"ISC","homepage":"https://github.com/financial-times/ip-wxp-fetch-wrapper#readme","repository":{"url":"git+https://github.com/financial-times/ip-wxp-fetch-wrapper.git","type":"git"},"description":"A small wrapper around fetch that throws custom http errors","contributors":[{"name":"Robin Marr","email":"robin.marr@ft.com"},{"name":"Kiya Gurmesa","email":"kiya.gurmesa@ft.com"},{"name":"Teja Thomas","email":"teja.thomas@ft.com"}],"maintainers":[{"email":"code.management@ft.com","name":"the-ft"},{"email":"info+npm@rowanmanning.com","name":"rowanmanning"},{"email":"yay@chee.party","name":"chee"},{"email":"a@ax.gy","name":"alexwilson"},{"email":"howdy@aendra.com","name":"aendra"},{"email":"emma.lewis@ft.com","name":"emmalewis"},{"email":"lee@leemoody.co.uk","name":"notlee"},{"email":"hamza.samih@ft.com","name":"hamza.samih"},{"email":"robert.boulton@ft.com","name":"robertboulton"},{"email":"leila.micollier@ft.com","name":"leila.micollier"},{"email":"rob.godfrey@ft.com","name":"robgodfrey"}],"readme":"# ip-wxp-fetch-wrapper\n\n[![CircleCI](https://circleci.com/gh/Financial-Times/ip-wxp-fetch-wrapper.svg?style=shield&circle-token=6841821b58c1d8e66f6e3dedd37ff99d6f2cf3eb)](https://circleci.com/gh/Financial-Times/ip-wxp-fetch-wrapper)\n[![npm version](https://badge.fury.io/js/%40financial-times%2Fip-wxp-fetch-wrapper.svg)](https://badge.fury.io/js/%40financial-times%2Fip-wxp-fetch-wrapper)\n\nA small wrapper around fetch that throws custom HTTP errors.\n\n## setup\n\nInstall via npm:\n\n```sh\n  npm i -S @financial-times/ip-wxp-fetch-wrapper\n```\n\n## usage\n\nA common pattern for fetch with async await looks like the below:\n\n```js\ntry{\n  const { AMAZING_KEY: API_KEY } = process.env\n  const response = await fetch('http://www.amazing.com/awesome-json', {\n    method: 'POST',\n    headers: {  API_KEY, 'content-type': 'application/json' },\n    body: { awesomeness: 9000 }\n  })\n\n  if(response.status === 200) {\n    console.log( await response.json())\n  } else {\n    // deal with the fetch error somehow\n    throw Error('fetch failed for some reason')\n  }\n} catch(err) {\n  // handle the URL/fetch error somehow e.g pass it to an error handler middleware in express\n  next(err);\n}\n```\n\nThis module wraps much of that pattern and throws custom HTTP Errors if fetch fails.\n\n```js\nconst { create } = require('@financial-times/ip-wxp-fetch-wrapper')\nconst { AMAZING_KEY: API_KEY } = process.env\nconst api = create('http://www.amazing.com', { headers: { 'content-type': 'application/json', 'API_KEY': 'AWESOME-KEY' }}, { bodyParser: 'text', errorParser: 'json', fetch: window.fetch})\n\ntry{\n  const result = await api.post('/awesome-json', { body: { awesomeness: 9000 } }\n  console.log(result) // receives a JSON object\n} catch(err) {\n  // will receive an HTTP Error with a status and name e.g. status: 404, name: NotFound\n  next(err)\n}\n```\n\n## methods\n\n### createMethod\n\nReturns a function with a canned configuration for querying an api.\n#### method\nThe HTTP Verb to be used for the request e.g GET\n#### baseUrl\nThe base url for requests, should be parsable by [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL).\nThis should include the protocol, hostname and port used by the request, it can also contain a partial pathname.\n\n#### opts\n\nAdditional options:\n\n- fetch - the fetch implementation to use (default: [isomorphic-fetch]())\n- bodyParser - the [body mixin](https://developer.mozilla.org/en-US/docs/Web/API/Body) function to use (default: [`json`](https://developer.mozilla.org/en-US/docs/Web/API/Body))\n- errorParser - the [body mixin](https://developer.mozilla.org/en-US/docs/Web/API/Body) function to use for error responses (default: bodyParser setting)\n\nReturns a method used to make an http request taking following arguments:\n\n- pathname - this will be concatenated onto the base url\n- options - an object of fetch options, this is merged with the config options passed to create the init argument for the request\n\n#### config = {}\n\nBase init for fetch requests, use for things like api key headers which need to be the same on every request.\n\n### createAll \nMaps all provided verbs to the method returned by `createMethod`, returns an object of schema { [verb]: method }.\n\n#### baseUrl\n\nSame as above\n#### opts = {}\n\nSame as above\n\n#### config\n\nSame as above\n\n#### verbs\n\nThe verbs to create methods for, defaults to the list in `http.json`, which is also the list provided by the node http module.\n\n### create\n\nSame as `createAll` above except the returned object also contains the HTTPErrors object.\n\n## HTTP Errors\n\nThe HttpErrors object contains a set of custom errors based on HTTP status codes, they extend the usual JS Error type but also include a status code and name e.g. status 400 name BadRequest.\n","readmeFilename":"README.md"}