Sha256: a08e12066eb2a5a8e7b6cd16cdc83b8919af7a5d14d61ee4531c88a961d4fd94
Contents?: true
Size: 782 Bytes
Versions: 7
Compression:
Stored size: 782 Bytes
Contents
require 'rest-core/promise' require 'rest-core/middleware' class RestCore::Engine include RestCore::Middleware def call env, &k req = env.merge(REQUEST_URI => request_uri(env)) promise = Promise.new(req, k, req[ASYNC]) promise.defer{ request(promise, req) } promise.future_response end private def payload_and_headers env Payload.generate_with_headers(env[REQUEST_PAYLOAD], env[REQUEST_HEADERS]) end def normalize_headers headers headers.inject({}){ |r, (k, v)| r[k.to_s.upcase.tr('-', '_')] = if v.kind_of?(Array) && v.size == 1 v.first else v end r } end end
Version data entries
7 entries across 7 versions & 1 rubygems