lib/elastic_apm/trace_context/tracestate.rb in elastic-apm-4.6.0 vs lib/elastic_apm/trace_context/tracestate.rb in elastic-apm-4.6.1
- old
+ new
@@ -90,10 +90,12 @@
end
end
extend Forwardable
+ ENTRY_SPLIT_REGEX = /\s*[\n,]+\s*/
+
def initialize(entries: {}, sample_rate: nil)
@entries = entries
self.sample_rate = sample_rate if sample_rate
end
@@ -138,10 +140,10 @@
# HTTP allows multiple headers with the same name, eg. multiple
# Set-Cookie headers per response.
# Rack handles this by joining the headers under the same key,
# separated by newlines.
# See https://www.rubydoc.info/github/rack/rack/file/SPEC
- String(str).split("\n").map { |s| s.split(',') }.flatten
+ String(str).split(ENTRY_SPLIT_REGEX).flatten
end
end
end
end
end