1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2020-2025, by Samuel Williams.
require_relative "split"
module Protocol
module HTTP
module Header
# 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.
class Vary < Split
# Initializes a `Vary` header with the given value. The value is split into distinct entries and converted to lowercase for normalization.
#
# @parameter value [String] the raw header value containing request header names separated by commas.
def initialize(value)
super(value.downcase)
end
# Adds one or more comma-separated values to the `vary` header. The values are converted to lowercase for normalization.
#
# @parameter value [String] the value or values to add, separated by commas.
def << value
super(value.downcase)
end
end
end
end
end
|