struct Athena::Framework::Config::ContentNegotiation::Rule
inherits Struct
#
Represents a rule that should be considered when determine the request's format.
Contains configuration options to control when the content negotiation logic should be applied.
Constructors#
.new(path : Regex = /^\//, host : Regex | String | Nil = nil, priorities : Array(String) | Nil = nil, fallback_format : String | Bool | Nil = false, methods : Array(String) | Nil = nil, stop : Bool = false)
#
Methods#
#fallback_format : String | Bool | Nil
#
Returns the format that should be used if a request does not allow for any of the formats within #priorities
.
Can be set to nil
to check the next rule in case of a priority mismatch.
Can be set to false
to raise an ATH::Exceptions::NotAcceptable
exception in case of a priority mismatch.
#host : Regex | ::Nil
#
Returns a Regex
representing the hostname that this rule should be scoped to.
parameters may be used to generalize this.
#methods : Array(String) | ::Nil
#
Returns the methods that this rule should optionally be scoped to.
#path : Regex
#
Returns the a Regex
representing the paths this rule should be scoped to.
#priorities : Array(String) | ::Nil
#
Returns the formats that should be considered for this set of routes. Must contain at least one format.
#stop? : Bool
#
Determines if ATH::Listeners::Format
should be enabled for this rule and any rule following it.