Sha256: e2509854def7bede8f103ff0815a5117728eeda54514b663d260522316abe921

Contents?: true

Size: 507 Bytes

Versions: 10

Compression:

Stored size: 507 Bytes

Contents

module Gemfury
  class Client
    class Handle503 < Faraday::Middleware
      def call(env)
        # This prevents errors in ParseJson 
        @app.call(env).on_complete do |out|
          out[:body] = '' if out[:status] == 503
        end
      end
    end

    class ParseJson < Faraday::Response::Middleware
      def parse(body)
        body =~ /\A\s*\z/ ? nil : MultiJson.decode(body)
      end

      def on_complete(response)
        response.body = parse(response.body)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gemfury-0.5.0 lib/gemfury/client/middleware.rb
gemfury-0.5.0.beta3 lib/gemfury/client/middleware.rb
gemfury-0.5.0.beta1 lib/gemfury/client/middleware.rb
gemfury-0.4.26 lib/gemfury/client/middleware.rb
gemfury-0.4.26.beta1 lib/gemfury/client/middleware.rb
gemfury-0.4.25 lib/gemfury/client/middleware.rb
gemfury-0.4.24.beta5 lib/gemfury/client/middleware.rb
gemfury-0.4.24.beta4 lib/gemfury/client/middleware.rb
gemfury-0.4.24.beta3 lib/gemfury/client/middleware.rb
gemfury-0.4.24.beta1 lib/gemfury/client/middleware.rb