Trivial HTTP response

This commit is contained in:
Magnus Hoff 2017-08-20 20:46:08 +02:00
parent aae43917e2
commit 9eb48f7ddc
2 changed files with 15 additions and 3 deletions

View file

@ -1,7 +1,9 @@
#[macro_use] extern crate diesel;
#[macro_use] extern crate diesel_codegen;
#[macro_use] extern crate lazy_static;
extern crate clap;
extern crate futures;
extern crate hyper;
use std::net::SocketAddr;

View file

@ -1,8 +1,13 @@
extern crate futures;
use futures::{self, Future};
use hyper;
use hyper::header::ContentType;
use hyper::mime;
use hyper::server::*;
lazy_static! {
static ref TEXT_HTML: mime::Mime = "text/html;charset=utf-8".parse().unwrap();
}
pub struct Site {
}
@ -13,6 +18,11 @@ impl Service for Site {
type Future = futures::BoxFuture<Response, Self::Error>;
fn call(&self, _req: Request) -> Self::Future {
unimplemented!()
futures::finished(
Response::new()
.with_header(ContentType(TEXT_HTML.clone()))
.with_body(format!("WOOOOOOOOOOT!"))
.with_status(hyper::StatusCode::Ok)
).boxed()
}
}