So, I have a Rack application which acts as a proxy. I have
implemented a net/http api to deal with the communication, so the rack
app basically calls it like this:
api.new(request_method, rack_request, options).response
.response returns a valid rack response [status, headers, body].
Body is an instance of the api, and it its implementation is like this
@proxy_connection = Net::HTTP.start(proxied_uri.host,
@proxy_connection.request(@proxy_request) do |response|
@proxy_response = response
The rack app can then call the proxied service with a full response
with to_s, or as a streaming and receive the response in chunks with
The thing is, when I return the response in rack, I'm getting the
following stack trace: https://gist.github.com/1879724
Apparently, the server or rack is calling 'each' more than once, but
I'm not sure what might be causing it.
The Rack app is running under rails 3.2.1.