Class: Ably::Rest::Middleware::FailIfUnsupportedMimeType
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- Ably::Rest::Middleware::FailIfUnsupportedMimeType
- Defined in:
- lib/submodules/ably-ruby/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 16 17 18 |
# File 'lib/submodules/ably-ruby/lib/ably/rest/middleware/fail_if_unsupported_mime_type.rb', line 8 def on_complete(env) unless env.response_headers['Ably-Middleware-Parsed'] == true # Ignore empty body with success status code for no body response return if env.body.to_s.empty? && env.status == 204 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 |