From Copy-Pasting curl Commands to Building My Own Java Parser (jquick-curl)
How a QA handoff turned into a weekend rabbit hole and eventually an open-source library Tags: java, opensource, http, curl, backend The Slack message that started it all It's 4:47 PM on a Thursday. QA drops this in the channel: curl -X POST https://api.internal.example.com/orders \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIs...' \ -H 'X-Trace-Id:…
On a Thursday afternoon, a QA member posted a curl command in the team's Slack channel, asking for help to troubleshoot why the request failed in staging but worked fine on their local machine. The QA member then decided to convert the curl command into a Java snippet by hand, line by line, for their backend service. This process became a repetitive task during integration weeks, where front-end teams would provide curl commands from their network tab, API documentation often included curl examples, and QA would paste curl commands into bug reports.
The author realized that this process of translating curl commands into Java code was inefficient and time-consuming, and he eventually decided to build an open-source library called jquick-curl to solve this problem. After researching existing solutions, the author found that using the real curl binary or an online converter didn't provide a long-term solution, as they required an external process or reinvented the boilerplate code.
The author preferred to keep the original curl command in the codebase, making it the single source of truth for the HTTP call.
The jquick-curl library parses the curl syntax directly within the JVM using ANTLR4, a grammar tool for defining parsers, without relying on any external process. The result is a Java library that can take a curl command as input and generate a structured request object, which can then be executed using OkHttp for the actual HTTP transport. This solution is portable across different platforms, and it keeps the original curl command unmodified, serving as the single source of truth for the HTTP request.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.