Generate CURL request from incoming request

Hi guys,

You know how you can “copy as cURL” in chrome devtools?

I’m looking for something similar where an incoming URL is converted to a CURL command and Logger.debugged or something. Would be nice for debugging webhooks.

I’ve been looking but could there be a Plug for this?

If none of those packages don’t help, then I wouldn’t have any additional ideas. Maybe look for Erlang libraries for it?

If it doesn’t exist yet it is certainly feasible to write it as a plug. You would basically gather the request method, URL, body, and headers (all of which are of course available to plugs), format them as a CURL command line invocation, and finally log it.

Thanks guys. Turns out it’s actually very easy for my very specific/limited use case. :+1:

1 Like