11use fastly:: http:: header;
22use fastly:: Request ;
33use hmac:: { Hmac , Mac } ;
4- use log;
54use sha2:: Sha256 ;
65use handlebars:: Handlebars ;
76use serde_json:: json;
@@ -69,7 +68,7 @@ pub fn get_or_generate_synthetic_id(settings: &Settings, req: &Request) -> Strin
6968 return potsi;
7069 }
7170
72- let req_cookie_jar: Option < cookie:: CookieJar > = handle_request_cookies ( & req) ;
71+ let req_cookie_jar: Option < cookie:: CookieJar > = handle_request_cookies ( req) ;
7372 match req_cookie_jar {
7473 Some ( jar) => {
7574 let potsi_cookie = jar. get ( "synthetic_id" ) ;
@@ -126,11 +125,11 @@ mod tests {
126125 fn test_generate_synthetic_id ( ) {
127126 let settings: Settings = create_settings ( ) ;
128127 let req = create_test_request ( vec ! [
129- ( & header:: USER_AGENT . to_string ( ) , "Mozilla/5.0" ) ,
130- ( & header:: COOKIE . to_string ( ) , "pub_userid=12345" ) ,
128+ ( header:: USER_AGENT . as_ref ( ) , "Mozilla/5.0" ) ,
129+ ( header:: COOKIE . as_ref ( ) , "pub_userid=12345" ) ,
131130 ( "X-Pub-User-ID" , "67890" ) ,
132- ( & header:: HOST . to_string ( ) , "example.com" ) ,
133- ( & header:: ACCEPT_LANGUAGE . to_string ( ) , "en-US,en;q=0.9" ) ,
131+ ( header:: HOST . as_ref ( ) , "example.com" ) ,
132+ ( header:: ACCEPT_LANGUAGE . as_ref ( ) , "en-US,en;q=0.9" ) ,
134133 ] ) ;
135134
136135 let synthetic_id = generate_synthetic_id ( & settings, & req) ;
@@ -154,7 +153,7 @@ mod tests {
154153 fn test_get_or_generate_synthetic_id_with_cookie ( ) {
155154 let settings = create_settings ( ) ;
156155 let req = create_test_request ( vec ! [ (
157- & header:: COOKIE . to_string ( ) ,
156+ header:: COOKIE . as_ref ( ) ,
158157 "synthetic_id=existing_cookie_id" ,
159158 ) ] ) ;
160159
0 commit comments