Protocol::HTTPSourceProtocolHTTPDuplicateHeaderError

class DuplicateHeaderError

Raised when a singleton (e.g. content-length) header is duplicated in a request or response.

Definitions

def initialize(key, existing_value, new_value)

Signature

parameter key String

The header key that was duplicated.

Implementation

def initialize(key, existing_value, new_value)
	super("Duplicate singleton header key: #{key.inspect}")
	
	@key = key
	@existing_value = existing_value
	@new_value = new_value
end

attr :key

Signature

attribute String

key The header key that was duplicated.

attr :existing_value

Signature

attribute String

existing_value The existing value for the duplicated header.

attr :new_value

Signature

attribute String

new_value The new value for the duplicated header.

def detailed_message(highlight: false)

Provides a detailed error message including the existing and new values.

Signature

parameter highlight Boolean

Whether to highlight the message (not currently used).

Implementation

def detailed_message(highlight: false)
	<<~MESSAGE
		#{self.message}
			Existing value: #{@existing_value.inspect}
			New value: #{@new_value.inspect}
	MESSAGE
end