Sha256: d129a3a9aa7728f46a94003992a2eafec38e0b9f6c3a52290f587a6ab6f7aa7e
Contents?: true
Size: 928 Bytes
Versions: 2
Compression:
Stored size: 928 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])) rescue FiberError end def process env, response 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.3 | lib/rest-core/app/coolio-fiber.rb |
rest-core-1.0.2 | lib/rest-core/app/coolio-fiber.rb |