Sha256: 5effa0275114df84cda3ca518de4b717e69f612fa8702fff3ed06869996b9ff6
Contents?: true
Size: 483 Bytes
Versions: 20
Compression:
Stored size: 483 Bytes
Contents
require 'rest-core/middleware' require 'rest-core/util/smash' class RestCore::SmashResponse def self.members; [:smash_response]; end include RestCore::Middleware def call env, &k return app.call(env, &k) if env[DRY] return app.call(env, &k) unless smash_response(env) app.call(env){ |res| if res[RESPONSE_BODY].kind_of?(Hash) yield(res.merge(RESPONSE_BODY => Smash.new(res[RESPONSE_BODY]))) else yield(res) end } end end
Version data entries
20 entries across 20 versions & 1 rubygems