Class: Goliath::RackProxy::RackCall

Inherits:
Object
  • Object
show all
Defined in:
lib/goliath/rack_proxy.rb

Overview

Allows “curry-calling” the Rack application, resuming the call as we’re receiving more request body data.

Instance Method Summary collapse

Constructor Details

#initialize(app, env, rewindable_input: true) ⇒ RackCall

Returns a new instance of RackCall.



72
73
74
75
76
# File 'lib/goliath/rack_proxy.rb', line 72

def initialize(app, env, rewindable_input: true)
  @app              = app
  @env              = env
  @rewindable_input = rewindable_input
end

Instance Method Details

#resume(data = nil, on_response: nil) ⇒ Object



78
79
80
81
82
83
# File 'lib/goliath/rack_proxy.rb', line 78

def resume(data = nil, on_response: nil)
  if fiber.alive?
    response = fiber.resume(data)
    on_response.call(response) if response && on_response
  end
end