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.
Blogpost: https://protiumx.github.io/blog/posts/an-http-request-parser-with-rust-and-pest-rs/
This project was born out of my boredom and curiosity about PEG. I'm wishing it will with help of the open source community.
- pest: PEG parser
- reqwest: HTTP requests
- tui-rs: TUI library
- crossterm: tui-rs backend
- tokio: asynchronous runtime
Contains the core functionality: pest
grammar and request execution.
CLI application that uses tui-rs
to render all the requests and a buffer to show responses.
This package is the default target for cargo
workspaces.
Run rq-cli
with cargo
:
cargo run -- requests.http
The pest
grammar can be found here.
You can use the pest editor to try it out and check how it works.
-- request --
{request_line}\r\n
{header \r\n \r\n}*
{body \r\n}*
A request
is conformed by: { request_line, headers, body}
, where headers
and body
are optional
matches.
A request_line
is conformed by: { method, target, version }
.
A headers
is a collection of header
{ header_name, header_value }
A body
is anything that doesn't match headers and has a preceding line break, as specified in the RFC.
PRs are always welcomed. Refer to the project TODO list for ideas!
If you find this project useful you can support my work with: