Struct common::Response [] [src]

pub struct Response {
    pub code: String,
    pub headers: HashMap<String, String>,
    pub body: Option<Vec<u8>>,
}

A standard structure for the server Response

A new response will be blank, so the methods status, header, and body need to be used to insert content.

Fields

Methods

impl Response
[src]

[src]

[src]

Modify the status string with a status code and optional message

example: let mut response = Response::new(); response.status("200", Some("Ok"));

[src]

Insert headers in the format of key, value

example: let mut response = Response::new(); response.header("Content-Type", "text/html");

[src]

Add/Remove a body from the Response

example: let mut response = Response::new(); response.body = Some("TEST".as_bytes().to_vec()); response.body = None;

[src]

Trait Implementations

impl ToString for Response
[src]

[src]

Converts the given value to a String. Read more