Struct rouille::Request [] [src]

pub struct Request { /* fields omitted */ }

Represents a request that your handler must answer to.

This can be either a real request (received by the HTTP server) or a mock object created with one of the fake_* constructors.

Methods

impl Request
[src]

Builds a fake HTTP request to be used during tests.

The remote address of the client will be 127.0.0.1:12345. Use fake_http_from to specify what the client's address should be.

Builds a fake HTTP request to be used during tests.

Builds a fake HTTPS request to be used during tests.

The remote address of the client will be 127.0.0.1:12345. Use fake_https_from to specify what the client's address should be.

Builds a fake HTTPS request to be used during tests.

If the decoded URL of the request starts with prefix, builds a new Request that is the same as the original but without that prefix.

Example

fn handle(request: &Request) -> Response {
    if let Some(request) = request.remove_prefix("/static") {
        if let Ok(r) = rouille::match_assets(&request, "/static") { return r; }
    }

    // ...
}Run

Returns true if the request uses HTTPS, and false if it uses HTTP.

Returns the method of the request (GET, POST, etc.).

Returns the raw URL requested by the client. It is not decoded and thus can contain strings such as %20, and the query parameters such as ?p=hello.

See also url().

Returns the raw query string requested by the client. In other words, everything after the first ? in the raw url.

Returns the empty string if no query string.

Returns the URL requested by the client.

Contrary to raw_url, special characters have been decoded and the query string (eg ?p=hello) has been removed.

If there is any non-unicode character in the URL, it will be replaced with U+FFFD.

Returns the value of a GET parameter. TODO: clumbsy

Returns the value of a header of the request.

Returns None if no such header could be found.

UNSTABLE. Returns the body of the request.

Will eventually return an object that implements Read instead of a Vec<u8>.

Returns the address of the client that made this request.