Method: AppMap::Util.select_headers
- Defined in:
- lib/appmap/util.rb
.select_headers(env) ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/appmap/util.rb', line 100 def select_headers(env) # Rack prepends HTTP_ to all client-sent headers. matching_headers = env .select { |k,v| k.start_with? 'HTTP_'} .reject { |k,v| v.blank? } .each_with_object({}) do |kv, memo| key = kv[0].sub(/^HTTP_/, '').split('_').map(&:capitalize).join('-') value = kv[1] memo[key] = value end matching_headers.blank? ? nil : matching_headers end |