Skip to content
Snippets Groups Projects
resp.rs 440 B
Newer Older
Stephen D's avatar
Stephen D committed
#[derive(Clone)]
pub struct Response {
    pub content_type: &'static str,
    pub data: Vec<u8>,
}

impl Response {
    pub fn html(html: String) -> Self {
        Self {
            content_type: "text/html; charset=utf-8",
            data: html.into_bytes(),
        }
    }
Stephen D's avatar
Stephen D committed

    pub fn css(css: String) -> Self {
        Self {
            content_type: "text/css; charset=utf-8",
            data: css.into_bytes(),
        }
    }
Stephen D's avatar
Stephen D committed
}