1. Convert a POST Request with JSON Payload
Backend DeveloperBackground
A developer is integrating a third-party payment gateway and has a working cURL command from the gateway's documentation.
Problem
Manually writing the Go boilerplate for http.NewRequest, setting headers, and encoding the JSON body is tedious and error-prone.
How to use
Paste the cURL command containing the JSON payload and authorization header into the input field, check 'Pretty-print body', and copy the generated Go code.
curl -X POST https://api.stripe.com/v1/charges -H "Authorization: Bearer key" -d "amount=2000¤cy=usd"Outcome
A clean Go code snippet using net/http that sets up the POST request, adds the Authorization header, and passes the URL-encoded body.