Original author here. Many smart people have contributed code over the years, but one warrants special mention.<p>About a year ago, verhovsky showed up out of nowhere. He rewrote the core of the application and increased the professionalism across the board. (dedicated domain, github page hosting, UI refresh, privacy improvements, and much more)<p>The tree-sitter PR is a monster achievement: <a href="https://github.com/curlconverter/curlconverter/pull/278" rel="nofollow">https://github.com/curlconverter/curlconverter/pull/278</a><p>Search for parseAnsiCString in there. I don't think that had ever been implemented in JavaScript before.<p>For you, verhovsky, 10x engineer might be an understatement. Thank you!
Seems to be mostly doing text-replacement and not actually understand what it's handling and what it can't actually do: <a href="https://github.com/icing/blog/blob/main/curl_on_a_weekend.md" rel="nofollow">https://github.com/icing/blog/blob/main/curl_on_a_weekend.md</a> (not my article, saw the link on twitter today)<p>E.g. it turns curl ftp://host.com into response = requests.get('<a href="http://ftp://host.com" rel="nofollow">http://ftp://host.com</a>')
Anybody else having reached the point of language indifference/boredom?<p>Everything I everywhere now see is just the same: Gluecode, library calls, unnecessary verbosity, Blackbox inside Blackbox etc.<p>And this project slaps it again into my face, with every example it’s literally always the same - only that language uses a colon, the other a semicolon, the other catches exceptions with ? etc. but in a way it’s all just the same.<p>How to overcome this?<p>I find, only pointfree notation has some beauty to it that makes reading code sweet again.
With the feature of browsers to copy requests as Curl and now this, it's funny to see curl commands be(com)ing some kind of lingua franca for HTTP request representation!<p>Now you can play a request and boom, you have your code to make this request in your favorite programming language.
It's interesting and I like it. It does seem to be rather opinionated without saying so. The PHP example requires an http library I hadn't heard of (rmccue/requests). Copy/paste of that code doesn't work unless you know how to find and install that library. The related tool they reference, however, does work using the PHP curl library.<p>I presume they were trying to keep the code to 4 lines or so. The curl library in PHP is rather verbose and requires 5 to 8 lines (depending on if you try to catch the error).<p><a href="https://www.php.net/manual/en/book.curl.php" rel="nofollow">https://www.php.net/manual/en/book.curl.php</a>
I wrote http-translator which is one of the linked related projects. It has a smaller feature set, but is just a few hundred lines and can be easily extended to support new frontends (input formats other than curl) and backends (i.e., output languages).<p><a href="https://ryan.govost.es/http-translator/" rel="nofollow">https://ryan.govost.es/http-translator/</a> | <a href="https://github.com/rgov/http-translator" rel="nofollow">https://github.com/rgov/http-translator</a><p>Mine was a project for learning modern-ish JavaScript, and I found that packages for parsing command line arguments in JS were generally poor. I wrote my own shell lexer that is simpler than Eric S. Raymond's in the Python standard library while passing the test suite, and since Burp Suite generates curl commands that use Bash ANSI C strings, I support those too. <a href="https://www.npmjs.com/package/shlex" rel="nofollow">https://www.npmjs.com/package/shlex</a><p>If I were to do further development, I would ditch my curl command line parsing in favor of building curl with Emscripten and having it generate the full HTTP request, then leverage the existing request parser.<p>curl already supports a —-libcurl flag that generates equivalent C code, and it might be easy to extract the curl_easy_setopt() calls from it.<p>Both our projects should probably support the built-in urllib.request for Python; Requests isn’t always necessary anymore.
Few other similar open source projects:<p>1. <a href="https://github.com/mholt/curl-to-go" rel="nofollow">https://github.com/mholt/curl-to-go</a><p>2. <a href="https://github.com/incarnate/curl-to-php" rel="nofollow">https://github.com/incarnate/curl-to-php</a>
I use Paw[1] for this, which is obviously a lot more powerful by allowing me to easily toggle and/or modify query params, headers, edit body as structured JSON / XML / application/x-www-form-urlencoded / multipart/form-data, etc. Probably doable in other API clients like Insomnia[2], too.<p>[1] <a href="https://paw.cloud/" rel="nofollow">https://paw.cloud/</a><p>[2] <a href="https://insomnia.rest/" rel="nofollow">https://insomnia.rest/</a>
Here's the one I often use for Ruby.
<a href="https://jhawthorn.github.io/curl-to-ruby/" rel="nofollow">https://jhawthorn.github.io/curl-to-ruby/</a>
I haven't touched it in years, but I made a utility to do the opposite in Go. Start with Go's request and transform it into a curl call. It was helpful for testing at the time. Looking at it, wow, that was 7 years ago!<p><a href="https://github.com/sethgrid/gencurl" rel="nofollow">https://github.com/sethgrid/gencurl</a>
Something a bit different but I'm a huge fan of NSwag recently.<p><a href="https://github.com/RicoSuter/NSwag" rel="nofollow">https://github.com/RicoSuter/NSwag</a><p>We use it on a project at work in C# and I've also been using it personally on pet projects with TypeScript.<p>Allows you to automatically generate REST API clients based on Swagger/OpenAPI specs and is very customizable.<p>Really nice if building out microservices and you're wanting to communicate between each other or building web apps and want to communicate with APIs. Saves a lot of time writing code to make requests and handle different status codes etc. Automatically generates all the classes/interfaces with sane naming schemes etc.<p>Even has a GUI application to generate the configs also if you wish.
I agree with the comments saying it should say "Language + Client library" instead of just language, as there are many ways of doing requests with different libraries.<p>Also, funny enough, the first command I tried didn't work as I expected, but thinking about it, it also seems hard to implement correctly. The cURL command I tried was "curl -v <a href="https://google.com/" rel="nofollow">https://google.com/</a>" but none of the implementations include verbose logging.<p>Weirdly, JSON is listed there, and it is absolutely not clear how JSON can be considered a language that can make HTTP requests. I wonder what client library that is?
I always thought this would be a cool feature to have in a http library. The library knows the best way to convert a curl command to its own internal representation. Something like requests.from_curl()
This looks great, was working myself on same. Good that i saw the link without wasting anymore time.<p>Had completed UI part as of now <a href="https://news.ycombinator.com/item?id=30642254" rel="nofollow">https://news.ycombinator.com/item?id=30642254</a>
I have a similar tool for Go:<p><a href="https://github.com/89z/format/tree/master/cmd/net" rel="nofollow">https://github.com/89z/format/tree/master/cmd/net</a>
I hope there is a better way to stringify / parse these headers and stuff; curl options seems be the best way there is right now. Unfortunately Insomnia etc. does not parse these.
I've gotten a lot out of Chrome debugger's "copy request as cURL" (among others) functionality. I gotta like seeing more of this kind of thing in the wild.