A pasted curl command often became a different request: -sX POST URL turned into GET POST, -D headers.txt URL into GET headers.txt, -I into a GET, -d @body.json was sent as that text, and commands copied with $'…' (bash) or ^"…^" (cmd) quoting were not converted.
The command is now split into words like the shell it was written for, every cURL option that takes a value is known and short-flag clusters are read, and data, form, upload, header and credential options map to what cURL sends. A command a request file can't express (standard input, several files joined with &, several commands) is pasted as it is. A test runs 31 commands through the real curl against a loopback server and compares them with the converted requests.
Co-authored-by: ntbang0901 <[email protected]>