Struct rouille::Response [] [src]

pub struct Response {
    pub status_code: u16,
    pub headers: Vec<(String, String)>,
    pub data: ResponseBody,
}

Contains a prototype of a response. The response is only sent when you call Request::respond.

Fields

The status code to return to the user.

List of headers to be returned in the response.

Note that important headers such as Connection or Content-Length will be ignored from this list.

An opaque type that contains the body of the response.

Methods

impl Response
[src]

UNSTABLE. Builds a default response to handle the given route error.

Important: don't use this in a real website. This function is just a convenience when prototyping.

For authentication-related errors, you are strongly encouraged to handle them yourself.

Builds a Response that redirects the user to another URL.

Builds a Response that outputs HTML.

Builds a Response that outputs plain text.

Builds a Response that outputs JSON.

Builds a Response that returns a 401 Not Authorized status and a WWW-Authenticate header.

Changes the status code of the response.