demo generated with vhs
rq is an interactive HTTP client that parses and execute requests. It attempts to provide a minimal CLI
alternative to vscode-restclient.
rq follows the standard RFC 2616.
Original author blogpost: https://protiumx.github.io/blog/posts/an-http-request-parser-with-rust-and-pest-rs/
cargo install --path rq-cliThe pest grammar can be found here.
You can use the pest editor to try it out and check how it works.
-- request --
{request_line}\n
{header\n\n}*
{body\n}?
A request is conformed by: { request_line, headers, body}, where headers and body are optional
matches.
request_lineis conformed by:{ method, target, version }.methodis one ofGET,POST,PUT,DELETE(optional, defaults toGET).targetis the target url.versionis one ofHTTP/0.9,HTTP/1.0,HTTP/1.1,HTTP/2.0,HTTP/3.0(optional, defaults toHTTP/1.1)
headersis a collection ofheader{ header_name, header_value }(optional).bodyis anything that doesn't match headers and has a preceding line break, as specified in the RFC (optional).
