httpbin 0.3.3

A httpbin reimplementation in rust. Works as a library and as a standalone webserver binary. (not affiliated to the original httpbin)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use std::path::Path;

use pages::{Response, not_found};
use service::{Request};

const PAGE_TEMPLATE: &'static str = include_str!("../templates/utf8.html");

pub fn serve<S: 'static>(req: Request) -> Response<S> {
    if req.suffix() == Path::new("utf-8") {
        req.html(PAGE_TEMPLATE)
    } else {
        not_found::serve(req)
    }
}