@@ -12,6 +12,7 @@ use cargo::core::{Package, TargetKind};
1212use rustc_serialize:: json:: { Json , ToJson } ;
1313use slug:: slugify;
1414use hyper:: client:: Client ;
15+ use hyper:: header:: { Accept , qitem} ;
1516use semver;
1617use postgres:: Connection ;
1718use time;
@@ -271,7 +272,9 @@ fn get_release_time_yanked_downloads
271272 // FIXME: There is probably better way to do this
272273 // and so many unwraps...
273274 let client = Client :: new ( ) ;
274- let mut res = client. get ( & url[ ..] ) . send ( ) . unwrap ( ) ;
275+ let mut res = try!( client. get ( & url[ ..] )
276+ . header ( Accept ( vec ! [ qitem( "application/json" . parse( ) . unwrap( ) ) ] ) )
277+ . send ( ) ) ;
275278 let mut body = String :: new ( ) ;
276279 res. read_to_string ( & mut body) . unwrap ( ) ;
277280 let json = Json :: from_str ( & body[ ..] ) . unwrap ( ) ;
@@ -385,7 +388,9 @@ fn add_owners_into_database(conn: &Connection,
385388 let owners_url = format ! ( "https://crates.io/api/v1/crates/{}/owners" ,
386389 & pkg. manifest( ) . name( ) ) ;
387390 let client = Client :: new ( ) ;
388- let mut res = client. get ( & owners_url[ ..] ) . send ( ) . unwrap ( ) ;
391+ let mut res = try!( client. get ( & owners_url[ ..] )
392+ . header ( Accept ( vec ! [ qitem( "application/json" . parse( ) . unwrap( ) ) ] ) )
393+ . send ( ) ) ;
389394 // FIXME: There is probably better way to do this
390395 // and so many unwraps...
391396 let mut body = String :: new ( ) ;
0 commit comments