Skip to content

Latest commit

 

History

History
67 lines (45 loc) · 2.42 KB

README.md

File metadata and controls

67 lines (45 loc) · 2.42 KB

rq

rq-core

preview

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.

Dependencies

Packages

rq-core

Contains the core functionality: pest grammar and request execution.

rq-cli

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

HTTP Request Grammar

The pest grammar can be found here. You can use the pest editor to try it out and check how it works.

Explanation

-- 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.

Contributing

PRs are always welcomed. Refer to the project TODO list for ideas!

Sponsorship

If you find this project useful you can support my work with:

Buy Me A Coffee