Sha256: f883fdeadfe767ffdb1fc8f1f14edcb60069a25b4b8a3ed2e1680dee02ec453e

Contents?: true

Size: 312 Bytes

Versions: 121

Compression:

Stored size: 312 Bytes

Contents

require 'multi_json'

module Acfs
  module Middleware

    # A middleware to automatically decode JSON responses.
    #
    class JsonDecoder < Base

      def response(response, nxt)
        response.data = ::MultiJson.load(response.body) if response.json?
        nxt.call response
      end
    end
  end
end

Version data entries

121 entries across 121 versions & 1 rubygems

Version Path
acfs-0.23.1.b198 lib/acfs/middleware/json_decoder.rb
acfs-0.23.1 lib/acfs/middleware/json_decoder.rb
acfs-0.23.0.b197 lib/acfs/middleware/json_decoder.rb
acfs-0.22.2.b196 lib/acfs/middleware/json_decoder.rb
acfs-0.23.0 lib/acfs/middleware/json_decoder.rb
acfs-0.22.2.b194 lib/acfs/middleware/json_decoder.rb
acfs-0.22.2.b193 lib/acfs/middleware/json_decoder.rb
acfs-0.22.2 lib/acfs/middleware/json_decoder.rb
acfs-0.22.1.b192 lib/acfs/middleware/json_decoder.rb
acfs-0.22.1 lib/acfs/middleware/json_decoder.rb
acfs-0.22.0.b191 lib/acfs/middleware/json_decoder.rb
acfs-0.22.0.b190 lib/acfs/middleware/json_decoder.rb
acfs-0.22.0 lib/acfs/middleware/json_decoder.rb
acfs-0.21.1.b189 lib/acfs/middleware/json_decoder.rb
acfs-0.21.1.rc1.b188 lib/acfs/middleware/json_decoder.rb
acfs-0.21.1 lib/acfs/middleware/json_decoder.rb
acfs-0.21.0.rc1.b187 lib/acfs/middleware/json_decoder.rb
acfs-0.21.1.rc1 lib/acfs/middleware/json_decoder.rb
acfs-0.21.0.rc1 lib/acfs/middleware/json_decoder.rb
acfs-0.22.0.rc1.b186 lib/acfs/middleware/json_decoder.rb