@@ -12,6 +12,7 @@ use cargo::core::{Package, TargetKind};
12
12
use rustc_serialize:: json:: { Json , ToJson } ;
13
13
use slug:: slugify;
14
14
use hyper:: client:: Client ;
15
+ use hyper:: header:: { Accept , qitem} ;
15
16
use semver;
16
17
use postgres:: Connection ;
17
18
use time;
@@ -271,7 +272,9 @@ fn get_release_time_yanked_downloads
271
272
// FIXME: There is probably better way to do this
272
273
// and so many unwraps...
273
274
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 ( ) ) ;
275
278
let mut body = String :: new ( ) ;
276
279
res. read_to_string ( & mut body) . unwrap ( ) ;
277
280
let json = Json :: from_str ( & body[ ..] ) . unwrap ( ) ;
@@ -385,7 +388,9 @@ fn add_owners_into_database(conn: &Connection,
385
388
let owners_url = format ! ( "https://crates.io/api/v1/crates/{}/owners" ,
386
389
& pkg. manifest( ) . name( ) ) ;
387
390
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 ( ) ) ;
389
394
// FIXME: There is probably better way to do this
390
395
// and so many unwraps...
391
396
let mut body = String :: new ( ) ;
0 commit comments