Sha256: 1504e689f2b70f98449823d971d101e1cfbbbe615819c5beecfafeb29639c548
Contents?: true
Size: 717 Bytes
Versions: 18
Compression:
Stored size: 717 Bytes
Contents
require 'rest-core/middleware' require 'restclient' class RestCore::RestClient include RestCore::Middleware def call env respond(env, ::RestClient::Request.execute(:method => env[REQUEST_METHOD ], :url => request_uri(env) , :payload => env[REQUEST_PAYLOAD], :headers => env[REQUEST_HEADERS])) rescue ::RestClient::Exception => e respond(env, e.response) end def respond env, response env.merge(RESPONSE_BODY => response.body, RESPONSE_STATUS => response.code, RESPONSE_HEADERS => response.raw_headers) end end
Version data entries
18 entries across 18 versions & 1 rubygems