struct Athena::Negotiation::Accept

Overview

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"

Defined in:

accept.cr

Constructors

Instance Method Summary

Instance methods inherited from struct Athena::Negotiation::BaseAccept

header : String header, normalized_header : String normalized_header, parameters : Hash(String, String) parameters, quality : Float32 quality

Constructor methods inherited from struct Athena::Negotiation::BaseAccept

new(header : String) new

Constructor Detail

def self.new(value : String) #

[View source]

Instance Method Detail

def media_range : String #

Returns the media range this Accept header represents.

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


[View source]
def 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]
def 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]