@@ -191,44 +191,42 @@ impl OtlpHttpHandler {
191191 ) ;
192192
193193 // Check for empty bodies using Content-Length when available
194- if let Some ( content_length) = req. headers ( ) . get ( hyper:: header:: CONTENT_LENGTH ) {
195- if let Ok ( length) = content_length. to_str ( ) {
196- if let Ok ( length) = length. parse :: < u64 > ( ) {
197- if length == 0 {
198- counter ! ( "bytes_received" , & self . labels) . increment ( 0 ) ;
199-
200- let ( response_bytes, content_type) = match ( path_ref, response_format) {
201- ( "/v1/metrics" , ResponseFormat :: Json ) => (
202- self . empty_metrics_response_json . clone ( ) ,
203- & self . content_type_json ,
204- ) ,
205- ( "/v1/metrics" , ResponseFormat :: Proto ) => (
206- self . empty_metrics_response_proto . clone ( ) ,
207- & self . content_type_proto ,
208- ) ,
209- ( "/v1/traces" , ResponseFormat :: Json ) => (
210- self . empty_traces_response_json . clone ( ) ,
211- & self . content_type_json ,
212- ) ,
213- ( "/v1/traces" , ResponseFormat :: Proto ) => (
214- self . empty_traces_response_proto . clone ( ) ,
215- & self . content_type_proto ,
216- ) ,
217- ( "/v1/logs" , ResponseFormat :: Json ) => (
218- self . empty_logs_response_json . clone ( ) ,
219- & self . content_type_json ,
220- ) ,
221- ( "/v1/logs" , ResponseFormat :: Proto ) => (
222- self . empty_logs_response_proto . clone ( ) ,
223- & self . content_type_proto ,
224- ) ,
225- _ => unreachable ! ( ) , // path already validated
226- } ;
227-
228- return self . build_response ( response_bytes, content_type) . await ;
229- }
230- }
231- }
194+ if let Some ( content_length) = req. headers ( ) . get ( hyper:: header:: CONTENT_LENGTH )
195+ && let Ok ( length) = content_length. to_str ( )
196+ && let Ok ( length) = length. parse :: < u64 > ( )
197+ && length == 0
198+ {
199+ counter ! ( "bytes_received" , & self . labels) . increment ( 0 ) ;
200+
201+ let ( response_bytes, content_type) = match ( path_ref, response_format) {
202+ ( "/v1/metrics" , ResponseFormat :: Json ) => (
203+ self . empty_metrics_response_json . clone ( ) ,
204+ & self . content_type_json ,
205+ ) ,
206+ ( "/v1/metrics" , ResponseFormat :: Proto ) => (
207+ self . empty_metrics_response_proto . clone ( ) ,
208+ & self . content_type_proto ,
209+ ) ,
210+ ( "/v1/traces" , ResponseFormat :: Json ) => (
211+ self . empty_traces_response_json . clone ( ) ,
212+ & self . content_type_json ,
213+ ) ,
214+ ( "/v1/traces" , ResponseFormat :: Proto ) => (
215+ self . empty_traces_response_proto . clone ( ) ,
216+ & self . content_type_proto ,
217+ ) ,
218+ ( "/v1/logs" , ResponseFormat :: Json ) => (
219+ self . empty_logs_response_json . clone ( ) ,
220+ & self . content_type_json ,
221+ ) ,
222+ ( "/v1/logs" , ResponseFormat :: Proto ) => (
223+ self . empty_logs_response_proto . clone ( ) ,
224+ & self . content_type_proto ,
225+ ) ,
226+ _ => unreachable ! ( ) , // path already validated
227+ } ;
228+
229+ return self . build_response ( response_bytes, content_type) . await ;
232230 }
233231
234232 // Non-empty body, implies a little more CPU work
@@ -257,7 +255,7 @@ impl OtlpHttpHandler {
257255 _ => unreachable ! ( "path already validated" ) ,
258256 }
259257 }
260- Err ( response) => return Ok ( response) ,
258+ Err ( response) => return Ok ( * response) ,
261259 } ;
262260
263261 let content_type = match response_format {
0 commit comments