Class: Protocol::HTTP::Header::Vary
- Defined in:
- lib/protocol/http/header/vary.rb
Overview
Represents the ‘vary` header, which specifies the request headers a server considers when determining the response.
The ‘vary` header is used in HTTP responses to indicate which request headers affect the selected response. It allows caches to differentiate stored responses based on specific request headers.
Constant Summary
Constants inherited from Split
Class Method Summary collapse
-
.coerce(value) ⇒ Object
Coerces a value into a parsed header object.
-
.parse(value) ⇒ Object
Parses a raw header value.
Instance Method Summary collapse
-
#<<(value) ⇒ Object
Adds one or more comma-separated values to the ‘vary` header.
Methods inherited from Split
Constructor Details
This class inherits a constructor from Protocol::HTTP::Header::Split
Class Method Details
.coerce(value) ⇒ Object
Coerces a value into a parsed header object.
27 28 29 30 31 32 33 34 |
# File 'lib/protocol/http/header/vary.rb', line 27 def self.coerce(value) case value when Array self.new(value.map(&:downcase)) else self.parse(value.to_s) end end |
.parse(value) ⇒ Object
Parses a raw header value.
19 20 21 |
# File 'lib/protocol/http/header/vary.rb', line 19 def self.parse(value) self.new(value.downcase.split(COMMA)) end |
Instance Method Details
#<<(value) ⇒ Object
Adds one or more comma-separated values to the ‘vary` header. The values are converted to lowercase for normalization.
39 40 41 |
# File 'lib/protocol/http/header/vary.rb', line 39 def << value super(value.downcase) end |