Module: Datadog::Tracing::Contrib::Rack::Header
- Defined in:
- lib/datadog/tracing/contrib/rack/header_collection.rb
Overview
Classes and utilities for handling headers in Rack.
Defined Under Namespace
Classes: RequestHeaderCollection
Class Method Summary collapse
Class Method Details
.to_rack_header(name) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/datadog/tracing/contrib/rack/header_collection.rb', line 33 def self.to_rack_header(name) key = name.to_s.upcase.gsub(/[-\s]/, '_') case key when 'CONTENT_TYPE', 'CONTENT_LENGTH' # NOTE: The Rack spec says: # > The environment must not contain the keys HTTP_CONTENT_TYPE or HTTP_CONTENT_LENGTH # > (use the versions without HTTP_). # See https://github.com/rack/rack/blob/e217a399eb116362710aac7c5b8dc691ea2189b3/SPEC.rdoc?plain=1#L119-L121 key else "HTTP_#{key}" end end |