class Roda::RodaPlugins::RequestHeaders::Headers
Constants
- CGI_VARIABLES
-
Set of environment variable names that don’t need HTTP_ prepended to them.
Public Class Methods
Source
# File lib/roda/plugins/request_headers.rb, line 58 def initialize(env) @env = env end
Public Instance Methods
Source
# File lib/roda/plugins/request_headers.rb, line 63 def [](key) @env[env_name(key)] end
Returns the value for the given key mapped to @env
Private Instance Methods
Source
# File lib/roda/plugins/request_headers.rb, line 70 def env_name(key) key = key.to_s.upcase key.tr!('-', '_') key = 'HTTP_' + key unless CGI_VARIABLES.include?(key) key end
Convert a HTTP header name into an environment variable name