Skip to content

Commit

Permalink
webdriver: Merge pull request #62 from jugglinmike/response-headers
Browse files Browse the repository at this point in the history
Correct response headers

Source-Repo: https://github.com/mozilla/webdriver-rust
Source-Revision: 91059d95763afdb06dc5219515ddcf4f6a5e0dfd

--HG--
extra : subtree_source : http%3A//tristan.corp.lon2.mozilla.com%3A8000
extra : subtree_revision : 7855e609ea286e0d70fa98678945e4712f8168d7
  • Loading branch information
jugglinmike committed Jan 24, 2017
1 parent 9901abb commit 96a8d6c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions testing/webdriver/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use std::sync::mpsc::{channel, Receiver, Sender};
use std::sync::Mutex;
use std::thread;

use hyper::header::ContentType;
use hyper::header::{ContentType, CacheControl, CacheDirective};
use hyper::mime::{Mime, TopLevel, SubLevel, Attr, Value};
use hyper::method::Method;
use hyper::Result;
use hyper::server::{Handler, Listening, Request, Response, Server};
Expand Down Expand Up @@ -223,7 +224,10 @@ impl <U: WebDriverExtensionRoute> Handler for HttpHandler<U> {
let resp_status = res.status_mut();
*resp_status = status;
}
res.headers_mut().set(ContentType::json());
res.headers_mut().set(
ContentType(Mime(TopLevel::Application, SubLevel::Json,
vec![(Attr::Charset, Value::Utf8)])));
res.headers_mut().set(CacheControl(vec![CacheDirective::NoCache]));
res.send(&resp_body.as_bytes()).unwrap();
},
_ => {}
Expand Down

0 comments on commit 96a8d6c

Please sign in to comment.