@@ -17,7 +17,7 @@ use std::ffi::OsStr;
17
17
18
18
use base64:: Engine ;
19
19
use futures_util:: StreamExt ;
20
- use http:: HeaderName ;
20
+ use http:: { header :: ACCEPT , HeaderName } ;
21
21
use minisign_verify:: { PublicKey , Signature } ;
22
22
use percent_encoding:: { AsciiSet , CONTROLS } ;
23
23
use reqwest:: {
@@ -345,7 +345,9 @@ impl Updater {
345
345
pub async fn check ( & self ) -> Result < Option < Update > > {
346
346
// we want JSON only
347
347
let mut headers = self . headers . clone ( ) ;
348
- headers. insert ( "Accept" , HeaderValue :: from_str ( "application/json" ) . unwrap ( ) ) ;
348
+ if !headers. contains_key ( ACCEPT ) {
349
+ headers. insert ( ACCEPT , HeaderValue :: from_static ( "application/json" ) ) ;
350
+ }
349
351
350
352
// Set SSL certs for linux if they aren't available.
351
353
#[ cfg( target_os = "linux" ) ]
@@ -549,10 +551,9 @@ impl Update {
549
551
) -> Result < Vec < u8 > > {
550
552
// set our headers
551
553
let mut headers = self . headers . clone ( ) ;
552
- headers. insert (
553
- "Accept" ,
554
- HeaderValue :: from_str ( "application/octet-stream" ) . unwrap ( ) ,
555
- ) ;
554
+ if !headers. contains_key ( ACCEPT ) {
555
+ headers. insert ( ACCEPT , HeaderValue :: from_static ( "application/octet-stream" ) ) ;
556
+ }
556
557
557
558
let mut request = ClientBuilder :: new ( ) . user_agent ( UPDATER_USER_AGENT ) ;
558
559
if let Some ( timeout) = self . timeout {
0 commit comments