Serving content at /api/content/<hash> (#2248)

This commit is contained in:
Tomasz Drwięga
2016-09-22 18:05:36 +02:00
committed by Gav Wood
parent 368aca521b
commit 862feb7172
6 changed files with 71 additions and 22 deletions

View File

@@ -42,7 +42,9 @@ pub type Handler = server::Handler<net::HttpStream> + Send;
pub trait Endpoint : Send + Sync {
fn info(&self) -> Option<&EndpointInfo> { None }
fn to_handler(&self, path: EndpointPath) -> Box<Handler>;
fn to_handler(&self, _path: EndpointPath) -> Box<Handler> {
panic!("This Endpoint is asynchronous and requires Control object.");
}
fn to_async_handler(&self, path: EndpointPath, _control: hyper::Control) -> Box<Handler> {
self.to_handler(path)