Method: Cyclid::API::Plugins::ApiExtension::Helpers#http_headers

Defined in:
app/cyclid/plugins/api.rb

#http_headers(environment) ⇒ Object

Extract headers from the raw request & pretty them up



142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'app/cyclid/plugins/api.rb', line 142

def http_headers(environment)
  http_headers = headers
  environment.each do |env|
    key, value = env
    match = key.match(/\AHTTP_(.*)\Z/)
    next unless match

    header = match[1].split('_').map(&:capitalize).join('-')
    http_headers[header] = value
  end

  return http_headers
end