Skip to content

struct

Request

pub struct Request {
    pub method: String,
    pub path: String,
    pub headers: Vec<(String, String)>,
}

An HTTP request, as the server reads it: its method, path (with the query) and headers.

Fields

method

pub method: String

The method: GET, POST…

path

pub path: String

The path, with its query string.

headers

pub headers: Vec<(String, String)>

Headers as (name, value) pairs.

Methods

header

pub fn header(&self, name: &str) -> Option<&str>

Case-insensitive header lookup.

accepts_encoding

pub fn accepts_encoding(&self, encoding: &str) -> bool

Whether Accept-Encoding allows encoding (q=0 means refused).

Trait implementations