leoek / fetch-to-curl

Convert javascript fetch requests to curl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Would love some more doc ...

bernd-wechner opened this issue · comments

Love the idea of this, and am keen to run a test, i.e. convert a fetch to a curl. Alas I lack the skills. I don't even rightly know where to begin. So I'd love to see a little more detail in the README if possible, helping noobs out a bit.

One of the deep ironies pf this to me, is that I'm not in a JS environment that's why I want the fetch I have converted to curl. Cursory efforts like using the console on Chrome's debugger, or saving the sample file as .json and running with node, all fail with import issues that I haven't resolved. To be sure some upskilling in JS dev and contexts would help and I'm headed that way, but a kindness would be some pointers here on such a useful tool. Because of the very irony that anyone with a fetch wanting to convert it to curl may well be wanting that precisely for lack of a JS environment.

Hi @bernd-wechner this library was meant to be used with a package manager like yarn or npm and not as a standalone application. The most common use case is to log requests automatically which are done by your application. To achieve this you'd usually create the curl string after or before doing a request with fetch. (This is the usecase which is outlined in the readme)

However you're right that it would be nice to have some kind of playground to use it without adding it to a js project. Also this playground is probably helpful as an example how it can be used without a package manager.

You can check the new playground out here: https://leoek.github.io/fetch-to-curl/playground.html 🎉
Hope this helps!

Thanks heaps. That is useful. And not just to me I'm sure, as I noted if you search (in any search engine) for fetch to curl you find 1000 curl to fetch solutions and only this one (and one other JS package) that profess to do fetch to curl. And all I needed was a quick question answered, essentially had a fetch in JS and fetch as a pile of options and needed to map those to curl somehow. In the end I admit as it was a spot need, I just read the docs on fetch and did it by hand until I got a curl that worked. But it won't be the last time someone searches the web for a fetch to curl and lands here I'm sure. So it's great that the README points to the playground now -- I'd call lit a sandbox but the idea is the same ;-)

Thanks for the explanation. There was indeed no proper solution for such a case before. Let's hope this will be helpful for other as well in the future :)