lib/hypertrace/instrumentation/net_http_patch.rb in hypertrace-agent-0.1.0 vs lib/hypertrace/instrumentation/net_http_patch.rb in hypertrace-agent-0.1.1

- old
+ new

@@ -15,11 +15,11 @@ }.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes) header_map = req.instance_variable_get(:@header) ht_attributes = Hypertrace::Instrumentation::DataCapture.headers_to_attribute_keys(header_map, Hypertrace::Instrumentation::DataCapture::TYPE_REQUEST) - content_type = header_map['content-type']&.first + content_type = header_map.find{|k, v| k.downcase == "content-type"}&.last if Hypertrace::Instrumentation::DataCapture.can_capture?(content_type, Hypertrace::Instrumentation::DataCapture::TYPE_REQUEST) body_cap = Hypertrace::Instrumentation::DataCapture.capturable_body(req.body) ht_attributes['http.request.body'] = body_cap if body_cap end tracer.in_span( @@ -33,10 +33,10 @@ response_headers = response.instance_variable_get(:@header) Hypertrace::Instrumentation::DataCapture.headers_to_attribute_keys(response_headers, Hypertrace::Instrumentation::DataCapture::TYPE_RESPONSE) do |k, v| span.set_attribute(k, v) end - content_type = response_headers['content-type']&.first + content_type = response_headers.find{|k, v| k.downcase == "content-type"}&.last if Hypertrace::Instrumentation::DataCapture.can_capture?(content_type, Hypertrace::Instrumentation::DataCapture::TYPE_RESPONSE) span.set_attribute('http.response.body', Hypertrace::Instrumentation::DataCapture.capturable_body(response.body)) end annotate_span_with_response!(span, response) end \ No newline at end of file