Sha256: 244e7439633316f02847f5a64daf89e5e4b047b3874b12e4b4c5273c75bd30b4
Contents?: true
Size: 681 Bytes
Versions: 12
Compression:
Stored size: 681 Bytes
Contents
require 'faraday' require 'json' module Ably module Rest module Middleware class FailIfUnsupportedMimeType < Faraday::Middleware 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 end end end end
Version data entries
12 entries across 12 versions & 2 rubygems