Exception: Protocol::HTTP::DuplicateHeaderError
- Includes:
- BadRequest
- Defined in:
- lib/protocol/http/error.rb
Overview
Raised when a singleton (e.g. ‘content-length`) header is duplicated in a request or response.
Instance Attribute Summary collapse
-
#existing_value ⇒ Object
readonly
Returns the value of attribute existing_value.
- #existing_value The existing value for the duplicated header.(Theexistingvalue) ⇒ Object readonly
-
#key ⇒ Object
readonly
Returns the value of attribute key.
- #key The header key that was duplicated.(Theheaderkeythatwasduplicated.) ⇒ Object readonly
-
#new_value ⇒ Object
readonly
Returns the value of attribute new_value.
- #new_value The new value for the duplicated header.(Thenewvalue) ⇒ Object readonly
Instance Method Summary collapse
-
#detailed_message(highlight: false) ⇒ String
Provides a detailed error message including the existing and new values.
-
#initialize(key, existing_value, new_value) ⇒ DuplicateHeaderError
constructor
A new instance of DuplicateHeaderError.
Constructor Details
#initialize(key, existing_value, new_value) ⇒ DuplicateHeaderError
Returns a new instance of DuplicateHeaderError.
30 31 32 33 34 35 36 |
# File 'lib/protocol/http/error.rb', line 30 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 |
Instance Attribute Details
#existing_value ⇒ Object (readonly)
Returns the value of attribute existing_value.
42 43 44 |
# File 'lib/protocol/http/error.rb', line 42 def existing_value @existing_value end |
#existing_value The existing value for the duplicated header.(Theexistingvalue) ⇒ Object (readonly)
42 |
# File 'lib/protocol/http/error.rb', line 42 attr :existing_value |
#key ⇒ Object (readonly)
Returns the value of attribute key.
39 40 41 |
# File 'lib/protocol/http/error.rb', line 39 def key @key end |
#key The header key that was duplicated.(Theheaderkeythatwasduplicated.) ⇒ Object (readonly)
39 |
# File 'lib/protocol/http/error.rb', line 39 attr :key |
#new_value ⇒ Object (readonly)
Returns the value of attribute new_value.
45 46 47 |
# File 'lib/protocol/http/error.rb', line 45 def new_value @new_value end |
#new_value The new value for the duplicated header.(Thenewvalue) ⇒ Object (readonly)
45 |
# File 'lib/protocol/http/error.rb', line 45 attr :new_value |
Instance Method Details
#detailed_message(highlight: false) ⇒ String
Provides a detailed error message including the existing and new values.
50 51 52 53 54 55 56 |
# File 'lib/protocol/http/error.rb', line 50 def (highlight: false) <<~MESSAGE #{self.} Existing value: #{@existing_value.inspect} New value: #{@new_value.inspect} MESSAGE end |