Struct common::Request [] [src]

pub struct Request {
    pub method: String,
    pub url: String,
    pub headers: HashMap<String, String>,
    pub body: Option<HashMap<String, String>>,
}

Incoming streams should be parsed to this struct

Fields

Methods

impl Request
[src]

[src]

Produce a blank Request

[src]

fetch any param in the request body, return either a ref to the string, or a Response that can be used if desired.

[src]

Parse any stream of bytes (u8) in to a Request if the stream is valid

example: let listener = TcpListener::bind("localhost:3000").unwrap(); for stream in listener { let request = parse_stream(&mut stream).unwrap(); }