struct

Athena::Negotiation::Accept

Inherits Athena::Negotiation::BaseAccept < Struct < Value < Object

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)
Source

Instance methods

media_range

Returns the media range this Accept header represents.

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

Source
sub_type

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

Source
type

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

Source