Class: Ably::Rest::Middleware::FailIfUnsupportedMimeType

Inherits:
Faraday::Response::Middleware
  • Object
show all
Defined in:
lib/ably/rest/middleware/fail_if_unsupported_mime_type.rb

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object


8
9
10
11
12
13
14
15
# File 'lib/ably/rest/middleware/fail_if_unsupported_mime_type.rb', line 8

def on_complete(env)
  unless env.response_headers['Ably-Middleware-Parsed'] == true
    unless  (500..599).include?(env.status)
      raise Ably::Exceptions::InvalidResponseBody,
            "Content Type #{env.response_headers['Content-Type']} is not supported by this client library"
    end
  end
end