@@ -100,13 +100,13 @@ impl ServerTiming {
100
100
pub fn value ( & self ) -> HeaderValue {
101
101
let mut output = String :: new ( ) ;
102
102
for ( n, timing) in self . timings . iter ( ) . enumerate ( ) {
103
- let timing: HeaderValue = timing. into ( ) ;
103
+ let timing: HeaderValue = timing. clone ( ) . into ( ) ;
104
104
match n {
105
- 1 => write ! ( output, "{}" , timing) ,
106
- _ => write ! ( output, ", {}" , timing) ,
105
+ 1 => write ! ( output, "{}" , timing) . unwrap ( ) ,
106
+ _ => write ! ( output, ", {}" , timing) . unwrap ( ) ,
107
107
} ;
108
108
}
109
- output. as_ref ( ) . into ( )
109
+ unsafe { HeaderValue :: from_bytes_unchecked ( output. into ( ) ) }
110
110
}
111
111
112
112
/// Push an entry into the list of entries.
@@ -251,9 +251,9 @@ mod test {
251
251
}
252
252
253
253
#[ test]
254
- fn to_header_values ( ) {
254
+ fn to_header_values ( ) -> crate :: Result < ( ) > {
255
255
let mut timings = ServerTiming :: new ( ) ;
256
- timings. push ( Entry :: new ( "server" . to_owned ( ) , None , None ) ?) ;
256
+ timings. push ( Metric :: new ( "server" . to_owned ( ) , None , None ) ?) ;
257
257
258
258
let mut headers = Headers :: new ( ) ;
259
259
timings. apply ( & mut headers) ;
0 commit comments