@@ -152,18 +152,21 @@ where
152152 For requests made from other clients, no change.
153153
154154 ## Section start */
155- if let Some ( kinesis_common_attributes) =
156- req. request ( ) . headers ( ) . get ( KINESIS_COMMON_ATTRIBUTES_KEY )
155+ if self . action . eq ( & Action :: Ingest )
156+ && let Some ( kinesis_common_attributes) =
157+ req. request ( ) . headers ( ) . get ( KINESIS_COMMON_ATTRIBUTES_KEY )
158+ && let Ok ( attribute_value) = kinesis_common_attributes. to_str ( )
159+ && let Ok ( message) = serde_json:: from_str :: < Message > ( attribute_value)
160+ && let Ok ( auth_value) =
161+ header:: HeaderValue :: from_str ( & message. common_attributes . authorization )
162+ && let Ok ( stream_name_key) =
163+ header:: HeaderValue :: from_str ( & message. common_attributes . x_p_stream )
157164 {
158- let attribute_value: & str = kinesis_common_attributes. to_str ( ) . unwrap ( ) ;
159- let message: Message = serde_json:: from_str ( attribute_value) . unwrap ( ) ;
160- req. headers_mut ( ) . insert (
161- HeaderName :: from_static ( AUTHORIZATION_KEY ) ,
162- header:: HeaderValue :: from_str ( & message. common_attributes . authorization ) . unwrap ( ) ,
163- ) ;
165+ req. headers_mut ( )
166+ . insert ( HeaderName :: from_static ( AUTHORIZATION_KEY ) , auth_value) ;
164167 req. headers_mut ( ) . insert (
165168 HeaderName :: from_static ( STREAM_NAME_HEADER_KEY ) ,
166- header :: HeaderValue :: from_str ( & message . common_attributes . x_p_stream ) . unwrap ( ) ,
169+ stream_name_key ,
167170 ) ;
168171 req. headers_mut ( ) . insert (
169172 HeaderName :: from_static ( LOG_SOURCE_KEY ) ,
0 commit comments