Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 1.72 KB

README.md

File metadata and controls

40 lines (30 loc) · 1.72 KB

rq

rq-core rq-cli

demo

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/

Installation

cargo install --path rq-cli

HTTP File

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}\n
{header\n\n}*
{body\n}?

A request is conformed by: { request_line, headers, body}, where headers and body are optional matches.

  • request_line is conformed by: { method, target, version }.
    • method is one of GET, POST, PUT, DELETE (optional, defaults to GET).
    • target is the target url.
    • version is one of HTTP/0.9, HTTP/1.0, HTTP/1.1, HTTP/2.0, HTTP/3.0 (optional, defaults to HTTP/1.1)
  • headers is a collection of header { header_name, header_value } (optional).
  • body is anything that doesn't match headers and has a preceding line break, as specified in the RFC (optional).