Skip to content

struct Athena::Routing::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.

Class methods#

.new(path : Regex = /^\//, host : Regex | String | Nil = nil, priorities : Array(String)? = nil, fallback_format : String | Bool | Nil = false, methods : Array(String)? = nil, stop : Bool = false) #

View source

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 ART::Exceptions::NotAcceptable exception in case of a priority mismatch.

View source

#host : Regex? #

Returns a Regex representing the hostname that this rule should be scoped to.

parameters may be used to generalize this.

View source

#methods : Array(String)? #

Returns the methods that this rule should optionally be scoped to.

View source

#path : Regex #

Returns the a Regex representing the paths this rule should be scoped to.

View source

#priorities : Array(String)? #

Returns the formats that should be considered for this set of routes. Must contain at least one format.

View source

#stop? : Bool #

Determines if ART::Listeners::Format should be enabled for this rule and any rule following it.

View source