Sha256: c061631fa10aa4f66a58497018f9e7ee18ab4a6e79c970b0ed98ee3fb47909b9
Contents?: true
Size: 594 Bytes
Versions: 2
Compression:
Stored size: 594 Bytes
Contents
# frozen_string_literal: true 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::Middleware def parse(body) body =~ /\A\s*\z/ ? nil : MultiJson.decode(body) end def on_complete(response) ok = response.request_headers['Accept'] =~ /json\z/ response.body = parse(response.body) if ok end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gemfury-0.13.0 | lib/gemfury/client/middleware.rb |
gemfury-0.13.0.beta1 | lib/gemfury/client/middleware.rb |