Skip to content

struct Athena::Negotiation::Accept
inherits Athena::Negotiation::BaseAccept #

Represents an Accept header media type.

accept = ANG::Accept.new "application/json; q = 0.75; charset = utf-8"

accept.header            # => "application/json; q = 0.75; charset = utf-8"
accept.normalized_header # => "application/json; charset=utf-8"
accept.parameters        # => {"charset" => "utf-8"}
accept.quality           # => 0.75
accept.type              # => "application"
accept.sub_type          # => "json"

Constructors#

.new(value : String)#

View source

Methods#

#media_range : String#

Returns the media range this Accept header represents.

I.e. #header minus the #quality and #parameters.

View source

#sub_type : String#

Returns the sub type for this Accept header. E.x. if the #media_range is application/json, the sub type would be json.

View source

#type : String#

Returns the type for this Accept header. E.x. if the #media_range is application/json, the type would be application.

View source