{"name":"@vespaiach/axios-fetch-adapter","version":"0.1.0","description":"Fetch adapter for axios","main":"dist/adapter.js","module":"dist/adapter.es.js","scripts":{"build":"rollup -c","test":"jest","prepublish":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/vespaiach/axios-fetch-adapter.git"},"keywords":["axios","adapter","fetch"],"author":{"name":"nta.toan@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/vespaiach/axios-fetch-adapter/issues"},"homepage":"https://github.com/vespaiach/axios-fetch-adapter#readme","devDependencies":{"axios":"^0.21.1","@babel/core":"^7.12.10","@babel/preset-env":"^7.12.11","@rollup/plugin-babel":"^5.2.3","@rollup/plugin-node-resolve":"^11.1.1","babel-jest":"^26.6.3","jest":"^26.6.3","rollup":"^2.38.2","rollup-jest":"^1.1.1"},"peerDependencies":{"axios":"^0.21.1"},"dependencies":{},"gitHead":"0862ec04703536bc130387c1c04fae5e69077f3c","_id":"@vespaiach/axios-fetch-adapter@0.1.0","_nodeVersion":"14.15.4","_npmVersion":"6.14.10","dist":{"integrity":"sha512-LhQGx780NUiRk6o/TDV/H3i4D7RgCM/ftLFtlZZxi3VXvtDnlOFqyhNLA5GcisfO7wQSDNx1OVgcuqAWutW4Ow==","shasum":"88af08002c3029926d88a2e288ab77ac0368e159","tarball":"http://registry-npm.ywwl.com/@vespaiach/axios-fetch-adapter/download/@vespaiach/axios-fetch-adapter-0.1.0.tgz","fileCount":11,"unpackedSize":31492,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgKnMnCRA9TVsSAnZWagAAKwsP/iTsSVAVV1N54WqAfSF7\n56BZC00GKGor2GoLzqe51lPsWjl9NTwkYJN2h3TeXyzQVYJ9AG4c3I9vxgAP\n4X5Ilkx9VZzZEjG+LFLPa234MkgmAIRf1orOyig8b1MJ4HzCeLrdv35aQIdS\nnUBYPqV3mgbGPc0b4nUuYQfC/0oVbTSRulHiZJNyTJJFJs1lF10t/rQ6eZn2\nALMzi8jpzB+JEt3/NQxGImPyZbUksq0v1PEmgBOhyiBt9C9kCOxPQneP9hW2\nLz6MPFbD1IhJ8/aQ1t7YU8j8NDojIP+ikf1TnptbUjdPqApMGLfRKJSD25Xm\nm87XOZ7t8mr5wZj/kn6L3o1TnNa8L1jv68MAqNX4NdJgPipLsIJ2UyV12JSd\nYQBYboOmBxa3A1kzQOb0BWdm/P4A4lNtCpbcgKAXdBsQWg2bFx8D/FZ1mkhf\nZeLIcriSf32UvCDt9ciHjIkPo7+q9U+FO2AnxONiZLGAWmW9mSj1jPEG3mnr\n6E1kKn+8glYM8nplH8IZid6eTRS2FST6b+vp9CE1eYm3q95JFiZkRfSrI72l\nd7AoNRkjNxFRmM5gDYLO293PALCWwIHNmV3EA31nOOyYwSy9m9VxzHG9koHW\nhRfn90djdRySp17M/8JlVhsR4y6xBU87rkAlEufgYfrSLJ0qnTSLECeTolB4\nFUAX\r\n=Xkbw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCncONpUb+d9D9SzTBioaQRJ7z4yKswmj2UcjPGw9euoQIhANwiFRoFh6+7oh9cUyo4UKUlZ4Y0/EEHTLhlgOFEv0bo"}],"size":7743,"noattachment":false,"key":"/@vespaiach/axios-fetch-adapter/-/@vespaiach/axios-fetch-adapter-0.1.0.tgz"},"_npmUser":{"name":"vespaiach","email":"nta.toan@gmail.com"},"directories":{},"maintainers":[{"name":"vespaiach","email":"nta.toan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/axios-fetch-adapter_0.1.0_1613394727321_0.5409041345367873"},"_hasShrinkwrap":false,"readme":"# Why\r\n\r\nI'm going to adopt PWA to my web applications and those web apps are heavily using Axios with the default XMLHTTPRequest adapter. Hence, I have to switch to Fetch adapter; However, Axios doesn't have an adapter for fetch API for now. So I write one to use while waiting for an offical one from Axios.\r\n\r\n# Installation and Usage\r\n\r\nYou can install the adapter directly from this repository URL or feel free to copy its source code to your project.\r\n\r\n``` sh\r\nnpm install axios\r\nnpm install @vespaiach/axios-fetch-adapter\r\n```\r\n\r\nThere are two ways to use it:\r\n\r\n1.  Create a new instance of Axios and pass this adapter in configuration\r\n\r\n``` js\r\nconst instance = axios.create({\r\n  baseURL: 'https://some-domain.com/api/',\r\n  timeout: 1000,\r\n  adapter: fetchAdapter\r\n  ....\r\n});\r\n```\r\n\r\n2.  Pass this adapter in each of request\r\n\r\n``` js\r\naxios.request({\r\n  url: '/user',\r\n  method: 'get',\r\n  adapter: fetchAdapter\r\n  ...\r\n})\r\n```\r\n\r\n3.  Use with FormData \r\n\r\n``` js\r\naxios.request({\r\n  url: '/user',\r\n  method: 'post',\r\n  adapter: fetchAdapter\r\n  data: new FormData(formId)\r\n  ...\r\n})\r\n```\r\n\r\n# Note\r\n\r\n- Since, this adapter relies on fetch API so it won't work in Node environment\r\n","publish_time":1613394727447,"_cnpm_publish_time":1613394727447,"dist-tags":{"latest":"0.3.1"}}