module Roda::RodaPlugins::HeaderMatchers::RequestMethods

Private Instance Methods

match_accept(mimetype) click to toggle source

Match if the given mimetype is one of the accepted mimetypes.

# File lib/roda/plugins/header_matchers.rb, line 37
def match_accept(mimetype)
  if @env["HTTP_ACCEPT"].to_s.split(',').any?{|s| s.strip == mimetype}
    response["Content-Type"] = mimetype
  end
end
match_header(key) click to toggle source

Match if the given uppercase key is present inside the environment.

# File lib/roda/plugins/header_matchers.rb, line 44
def match_header(key)
  @env[key.upcase.tr("-","_")]
end
match_host(hostname) click to toggle source

Match if the host of the request is the same as the hostname.

# File lib/roda/plugins/header_matchers.rb, line 49
def match_host(hostname)
  hostname === host
end