sweep most unwraps from ethcore crate, dapps crate (#2762)

* sweep most unwraps from ethcore crate

* purge unwrap from dapps server

* whitespace

[ci:none]
This commit is contained in:
Robert Habermeier
2016-10-20 23:41:15 +02:00
committed by Gav Wood
parent 866ab9c7a3
commit 96f4c10453
31 changed files with 150 additions and 80 deletions

View File

@@ -128,7 +128,12 @@ impl<T: Dapp> server::Handler<HttpStream> for PageHandler<T> {
match self.file {
ServedFile::File(ref f) => {
res.set_status(StatusCode::Ok);
res.headers_mut().set(header::ContentType(f.content_type().parse().unwrap()));
match f.content_type().parse() {
Ok(mime) => res.headers_mut().set(header::ContentType(mime)),
Err(()) => debug!(target: "page_handler", "invalid MIME type: {}", f.content_type()),
}
// Security headers:
add_security_headers(&mut res.headers_mut(), self.safe_to_embed_at_port);
Next::write()