lib/praxis/action_definition/headers_dsl_compiler.rb
# it allows to define expectations on incoming headers. For example:
# header :X_SpecialCookie                        => implies the header is required
# header :X_Something, /matching_this/           => implies that if the name header exists, it should match the regexp
# header :X_A_Header, "Specific String"          => implies that the value matches the string exactly
# In any of the cases, other supported options might be passed
# header :X_Something, /matching_this/ ,
#                     required: true             => to make it required
#                     description: "lorem ipsum" => to describe it (like any other attribute)
it allows to define expectations on incoming headers.
it allows to define expectations on incoming headers .
def header(name, val=nil, **options)
        if val.kind_of?(Class)
          return key name, val, **options  
        end
        case val
        when Regexp
          options[:regexp] = val
        when String
          options[:values] = [val]
        when nil
          options[:required] = true if options.empty?
        end
        key name , String, options
      end
def header ( name , val = nil , ** options ) if val . kind_of? ( Class ) return key name , val , ** options end case val when Regexp options [ :regexp ] = val when String options [ :values ] = [ val ] when nil options [ :required ] = true if options . empty? end key name , String , options end
it allows to define expectations on incoming headers.
it allows to define expectations on incoming headers .
# Defining the existence without any other options can only mean that it is required (otherwise it is a useless definition)
name
<not_specific>
val
<not_specific>
options
<not_specific>