lib/hyperion_test/kim.rb in hyperion_http-0.2.4 vs lib/hyperion_test/kim.rb in hyperion_http-0.3.0

- old
+ new

@@ -73,12 +73,13 @@ begin opts = {Port: @port, Logger: ::Logger.new('/dev/null'), AccessLog: []} # hide output Rack::Handler::WEBrick.run(method(:handle_request), opts) do |webrick| q.push(webrick) end - ensure + rescue Exception => e $stderr.puts "Hyperion fake server on port #{@port} exited unexpectedly!" unless @stopped + raise e end end @webrick = q.pop end end @@ -157,12 +158,12 @@ .join('-') end def handle(req) pred_value, func = @handlers.lazy - .map { |h| [h.pred.call(req), h.func] } - .select { |(pv, _)| pv } - .first || [nil, no_route_matched_func] + .map { |h| [h.pred.call(req), h.func] } + .select { |(pv, _)| pv } + .first || [nil, no_route_matched_func] func.call(pred_value.is_a?(Request) ? pred_value : req) end def massage_response(r) if triplet?(r)