You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey! Thanks a lot for this great library 🙂 I'm using it in a production project already, and currently implementing it in another.
I think one great improvement would be to allow passing a custom HTTP client in case you don't want to use Axios. This can be super helpful if you're using a custom client with added features such as deduping, caching, etc. For example, I'm currently working with Next.js and React Server Components, and the recommended way to fetch data only once server-side is to use a monkey-patched fetch client that caches requests forever.
The API could look something like this (here, using window.fetch):
import{parse}from'rss-to-json';constclient=(url: string)=>fetch(url).then((r)=>r.text()).then((data)=>({ data }));(async()=>{constrss=awaitparse('https://blog.ethereum.org/feed.xml',client);console.log(JSON.stringify(rss,null,3));})();
I know the parse function currently takes Axios options as its second argument, but this can be circumvented by simply checking the type (object vs. function).
Hey! Thanks a lot for this great library 🙂 I'm using it in a production project already, and currently implementing it in another.
I think one great improvement would be to allow passing a custom HTTP client in case you don't want to use Axios. This can be super helpful if you're using a custom client with added features such as deduping, caching, etc. For example, I'm currently working with Next.js and React Server Components, and the recommended way to fetch data only once server-side is to use a monkey-patched
fetch
client that caches requests forever.The API could look something like this (here, using
window.fetch
):I know the
parse
function currently takes Axios options as its second argument, but this can be circumvented by simply checking the type (object vs. function).If you're open to this feature, check my PR 🙂
The text was updated successfully, but these errors were encountered: