Sha256: 2d40b2e5404d45fb86884df06d9c129225c6408b02c8440f5704b80b94b6f301
Contents?: true
Size: 645 Bytes
Versions: 22
Compression:
Stored size: 645 Bytes
Contents
require 'rest-core/middleware' require 'rest-core/util/parse_query' class RestCore::QueryResponse def self.members; [:query_response]; end include RestCore::Middleware QUERY_RESPONSE_HEADER = {'Accept' => 'application/x-www-form-urlencoded'}.freeze def call env, &k return app.call(env, &k) if env[DRY] return app.call(env, &k) unless query_response(env) headers = QUERY_RESPONSE_HEADER.merge(env[REQUEST_HEADERS]||{}) app.call(env.merge(REQUEST_HEADERS => headers)) do |response| body = ParseQuery.parse_query(response[RESPONSE_BODY]) yield(response.merge(RESPONSE_BODY => body)) end end end
Version data entries
22 entries across 22 versions & 1 rubygems