File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,9 @@ use std::time::Duration;
20
20
21
21
use anyhow:: anyhow;
22
22
use chrono:: { DateTime , Utc } ;
23
+ use http:: header;
23
24
24
- use crate :: about;
25
+ use crate :: { about, parseable :: PARSEABLE } ;
25
26
26
27
use super :: uid;
27
28
@@ -32,11 +33,19 @@ pub struct LatestRelease {
32
33
}
33
34
34
35
pub async fn get_latest ( deployment_id : & uid:: Uid ) -> Result < LatestRelease , anyhow:: Error > {
36
+ let send_analytics = PARSEABLE . options . send_analytics . to_string ( ) ;
37
+ let mut headers = header:: HeaderMap :: new ( ) ;
38
+ headers. insert (
39
+ "P_SEND_ANONYMOUS_USAGE_DATA" ,
40
+ header:: HeaderValue :: from_str ( send_analytics. as_str ( ) ) . expect ( "valid header value" ) ,
41
+ ) ;
35
42
let agent = reqwest:: ClientBuilder :: new ( )
36
43
. user_agent ( about:: user_agent ( deployment_id) )
44
+ . default_headers ( headers)
37
45
. timeout ( Duration :: from_secs ( 8 ) )
38
46
. build ( )
39
47
. expect ( "client can be built on this system" ) ;
48
+
40
49
let json: serde_json:: Value = agent
41
50
. get ( "https://download.parseable.io/latest-version" )
42
51
. send ( )
You can’t perform that action at this time.
0 commit comments