Allow cross-origin requests to the web API

This commit is contained in:
Tiffany Bennett 2016-08-14 12:19:37 -04:00
parent fb56fb9ecd
commit 56b990e968

View file

@ -32,6 +32,7 @@ fn main() {
use url::form_urlencoded; use url::form_urlencoded;
let req = move |mut req: Request, mut res: Response| { let req = move |mut req: Request, mut res: Response| {
res.headers_mut().set::<header::AccessControlAllowOrigin>(header::AccessControlAllowOrigin::Any);
match req.method { match req.method {
hyper::Get => { hyper::Get => {
write!(res.start().unwrap(), "{}", TEMPLATE).unwrap(); write!(res.start().unwrap(), "{}", TEMPLATE).unwrap();