Module: Roda::RodaPlugins::HeaderMatchers
- Defined in:
- lib/roda/plugins/header_matchers.rb
Overview
The header_matchers plugin adds hash matchers for matching on less-common HTTP headers.
plugin :header_matchers
It adds a :header
matcher for matching on arbitrary headers, which matches if the header is present:
route do |r|
r.on :header=>'X-App-Token' do
end
end
It adds a :host
matcher for matching by the host of the request:
route do |r|
r.on :host=>'foo.example.com' do
end
end
It adds an :accept
matcher for matching based on the Accept header:
route do |r|
r.on :accept=>'text/csv' do
end
end
Note that the accept matcher is very simple and cannot handle wildcards, priorities, or anything but a simple comma separated list of mime types.
Defined Under Namespace
Modules: RequestMethods