Exception: SSE::Errors::HTTPContentTypeError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/ld-eventsource/errors.rb

Overview

An exception class representing an invalid HTTP content type. This can be passed to the error handler specified in Client#on_error.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, headers = nil) ⇒ HTTPContentTypeError

Returns a new instance of HTTPContentTypeError.



40
41
42
43
44
# File 'lib/ld-eventsource/errors.rb', line 40

def initialize(type, headers = nil)
  @content_type = type
  @headers = headers
  super("invalid content type \"#{type}\"")
end

Instance Attribute Details

#headersHash? (readonly)

The HTTP response headers, if any.

The headers object uses case-insensitive keys (via the http gem’s HTTP::Headers).

Returns:

  • (Hash, nil)

    the response headers, or nil if not available



55
56
57
# File 'lib/ld-eventsource/errors.rb', line 55

def headers
  @headers
end

#typeString (readonly)

The HTTP content type.

Returns:

  • (String)


48
49
50
# File 'lib/ld-eventsource/errors.rb', line 48

def type
  @type
end