AlbinoDrought / cachios

Simple axios cache wrapper using node-cache
MIT License
88 stars 10 forks source link

Allow method to be inside options #73

Open GiedriusVil opened 2 years ago

GiedriusVil commented 2 years ago

Axios allows to execute request set in options, rather than used as a method: await axios({ url: 'https://httpbin.org/post', method: 'post' });

Could we have the same in Cachios?

AlbinoDrought commented 2 years ago

Cachios doesn't currently work when called as a function (is this easy to add? I've never done this myself).

As an alternative, there is support for axios.request: https://runkit.com/albinodrought/62979de32563a4000865bbff

const cachios = require('cachios');

(async () => {
    console.log(await cachios.request({ url: 'https://httpbin.org/post', method: 'post' }));
})();

Would this work?