Closed kevinschweikert closed 3 months ago
Wording ideas for staying true to Req:
Wording ideas for curl style
There is also the question of which mode should be the standard one. If you look at it from that perspective, perhaps we do the "approximate" mode as the standard mode, and then you only need to come up with one name, let's say "debug", which gives you as close to exactly what req is going to do.
What do you think?
Yeah i'm with you. The default should be the curl native flags and we strip the user agent and modify the headers into curls own functionality even when that is not the exact request. That would make it easier for curl user to understand what's happening and is more readable.
My idea would be to add a option to to_curl/2
which would look something like
Req.new(url: "http://example.com", ) |> CurlReq.to_curl(style: :curl) #default if no style specified
"curl --compressed -X GET http://example.com"
Req.new(url: "http://example.com") |> CurlReq.to_curl(style: :req)
"curl -H "accept-encoding: gzip" -H "user-agent: req/0.5.0" -X GET http://example.com"
If you're happy with this, i can work on a PR
I am happy with this. PR would be much appreciated.
_Originally posted by @derekkraan in https://github.com/derekkraan/curl_req/pull/5#discussion_r1628882584_