Sha256: f3c4f7081190bddbb87b801e8a9121a36a3bd1c31cb7f2b820e064743b07bb35
Contents?: true
Size: 1.11 KB
Versions: 5
Compression:
Stored size: 1.11 KB
Contents
class Rack::App::Endpoint::Executor def initialize(endpoint_properties) @endpoint_properties = endpoint_properties end def call(env) return catch(:rack_response){ execute(env) }.finish end protected def execute(env) request_handler = env[Rack::App::Constants::ENV::HANDLER] set_response_body(request_handler, get_response_body(request_handler)) return request_handler.response end def get_response_body(request_handler) catch :response_body do evaluated_value = evaluate_value(request_handler) evaluated_value end end EXTNAME = ::Rack::App::Constants::ENV::EXTNAME def set_response_body(handler, response_body) extname = handler.request.env[EXTNAME] handler.response.headers.merge!(@endpoint_properties.serializer.response_headers_for(extname)) handler.response.write(@endpoint_properties.serializer.serialize(extname, response_body)) end def evaluate_value(request_handler) @endpoint_properties.error_handler.execute_with_error_handling_for(request_handler) do request_handler.instance_exec(&@endpoint_properties.callable) end end end
Version data entries
5 entries across 5 versions & 1 rubygems