Sha256: 9c98f8021748f6414d660e62cf64fdbc73c5decadb80c7521d82ee4d95a79cee
Contents?: true
Size: 944 Bytes
Versions: 2
Compression:
Stored size: 944 Bytes
Contents
require 'rest-core/middleware' require 'cool.io-http' class RestCore::CoolioFiber include RestCore::Middleware def call env process(env, ::Coolio::HttpFiber.request(:method => env[REQUEST_METHOD] , :url => request_uri(env) , :payload => env[REQUEST_PAYLOAD], :headers => env[REQUEST_HEADERS])) end def process env, response env[TIMER].detach if env[TIMER] Thread.current[:coolio_http_client].detach if Thread.current[:coolio_http_client].kind_of?(::Coolio::HttpFiber) raise response if response.kind_of?(::Exception) result = env.merge(RESPONSE_BODY => response.body , RESPONSE_STATUS => response.status, RESPONSE_HEADERS => response.headers) result[ASYNC].call(result) if result[ASYNC] result end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rest-core-1.0.1 | lib/rest-core/app/coolio-fiber.rb |
rest-core-1.0.0 | lib/rest-core/app/coolio-fiber.rb |