Show HN: curlmin – Curl Request Minimizer

3 noperator 0 6/13/2025, 1:41:26 PM github.com ↗
curlmin is a CLI tool that minimizes curl commands by removing unnecessary headers, cookies, and query parameters while ensuring the response remains the same. This is especially handy when copying a network request "as cURL" in Chrome DevTools' Network panel (Right-click page > Inspect > Network > Right-click request > Copy > Copy as cURL).

I use Chrome's "Copy as cURL" _a lot_ (so much, in fact, that I wrote https://github.com/noperator/sol partially just to help me auto-format long curl commands). I often have this problem where the copied curl command contains a bunch of garbage (namely, extra headers and cookies for tracking purposes) that isn't at all relevant to the actual request being made. After years of manually trimming out cookies in order to see which ones are actually necessary to maintain a stateful authenticated session, I finally decided to make a tool to automate the minification of a curl command.

curlmin will take a big ol' curl command like this:

  curl \
     -H 'Authorization: Bearer xyz789' \
     -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' \
     -H 'Accept: text/html,application/xhtml+xml,application/xml' \
     -H 'Accept-Language: en-US,en;q=0.9' \
     -H 'Cache-Control: max-age=0' \
     -H 'Connection: keep-alive' \
     -H 'Upgrade-Insecure-Requests: 1' \
     -H 'Cookie: _ga=GA1.2.1234567890.1623456789; session=abc123; _gid=GA1.2.9876543210.1623456789' \
     -H 'Cookie: _fbp=fb.1.1623456789.1234567890' \
     -H 'Cookie: _gat=1; thisis=notneeded' \
     -b 'preference=dark; language=en; theme=blue' \
     'http://localhost:8080/api/test?auth_key=def456&timestamp=1623456789&tracking_id=abcdef123456&utm_source=test&utm_medium=cli&utm_campaign=curlmin'
And reduce it to the minimum necessary elements to satisfy the request:

  curl -H 'Authorization: Bearer xyz789' -H 'Cookie: session=abc123' 'http://localhost:8080/api/test?auth_key=def456'

Comments (0)

No comments yet