11use fastly:: http:: header;
22use fastly:: Request ;
33use hmac:: { Hmac , Mac } ;
4- use log;
54use sha2:: Sha256 ;
65
76use crate :: constants:: SYNTH_HEADER_POTSI ;
@@ -65,7 +64,7 @@ pub fn get_or_generate_synthetic_id(settings: &Settings, req: &Request) -> Strin
6564 return potsi;
6665 }
6766
68- let req_cookie_jar: Option < cookie:: CookieJar > = handle_request_cookies ( & req) ;
67+ let req_cookie_jar: Option < cookie:: CookieJar > = handle_request_cookies ( req) ;
6968 match req_cookie_jar {
7069 Some ( jar) => {
7170 let potsi_cookie = jar. get ( "synthetic_id" ) ;
@@ -121,11 +120,11 @@ mod tests {
121120 fn test_generate_synthetic_id ( ) {
122121 let settings: Settings = create_settings ( ) ;
123122 let req = create_test_request ( vec ! [
124- ( & header:: USER_AGENT . to_string ( ) , "Mozilla/5.0" ) ,
125- ( & header:: COOKIE . to_string ( ) , "pub_userid=12345" ) ,
123+ ( header:: USER_AGENT . as_ref ( ) , "Mozilla/5.0" ) ,
124+ ( header:: COOKIE . as_ref ( ) , "pub_userid=12345" ) ,
126125 ( "X-Pub-User-ID" , "67890" ) ,
127- ( & header:: HOST . to_string ( ) , "example.com" ) ,
128- ( & header:: ACCEPT_LANGUAGE . to_string ( ) , "en-US,en;q=0.9" ) ,
126+ ( header:: HOST . as_ref ( ) , "example.com" ) ,
127+ ( header:: ACCEPT_LANGUAGE . as_ref ( ) , "en-US,en;q=0.9" ) ,
129128 ] ) ;
130129
131130 let synthetic_id = generate_synthetic_id ( & settings, & req) ;
@@ -148,7 +147,7 @@ mod tests {
148147 fn test_get_or_generate_synthetic_id_with_cookie ( ) {
149148 let settings = create_settings ( ) ;
150149 let req = create_test_request ( vec ! [ (
151- & header:: COOKIE . to_string ( ) ,
150+ header:: COOKIE . as_ref ( ) ,
152151 "synthetic_id=existing_cookie_id" ,
153152 ) ] ) ;
154153
0 commit comments