summaryrefslogtreecommitdiff
path: root/src/auth_handler/handler_info.rs
blob: 0aeaa090268b13b7c08197fb8b52a605366c9ebe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use std::io;

use tokio::prelude::*;

use http::{Request, Response, StatusCode};
use bytes::Bytes;

use ::ApplicationState;
use super::AuthHandler;

pub(in super) fn respond<'a>(auth_handler: &AuthHandler, state: &ApplicationState, req: &Request<Bytes>,
                             path_rest: &'a str) -> Response<String> {
    let body = html! {
            : horrorshow::helper::doctype::HTML;
            html {
                head {
                    title: "Hello world!";
                }
                body {
                    h1(id = "heading") {
                        : "Hello! This is <html />";
                        : "And path rest is: ";
                        : path_rest;
                        : "... ok :)";
                    }
                }
            }
        };
    Response::builder().body(body.to_string()).unwrap()
}