module Xenon::Routing::HeaderDirectives
Public Instance Methods
header(name) { |value| ... }
click to toggle source
# File lib/xenon/routing/header_directives.rb, line 14 def header(name) optional_header(name) do |value| if value yield value else reject Rejection.new(:header, { required: name }) end end end
optional_header(name) { |header| ... }
click to toggle source
# File lib/xenon/routing/header_directives.rb, line 8 def optional_header(name) extract_request do |request| yield request.header(name) end end
respond_with_header(header) { || ... }
click to toggle source
# File lib/xenon/routing/header_directives.rb, line 24 def respond_with_header(header) map_response -> r { r.copy(headers: r.headers.add(header)) } do yield end end