I haven't tested this but an HTTP streaming response should *not* have a 
Content-Length header. Maybe that's enough to detect whether it's streaming 
or not? So you look at the properties of the HTTP response itself instead 
of the Ruby wrapper, which as you say might change in the future.


On Monday, 14 July 2014 22:14:31 UTC+1, Jason Clark wrote:
>
> I'm curious if there's a good way to detect from a Rack middleware whether 
> a response is streaming or not.
>
> From what I can see, my options are:
>
> * In the Controller note we've included `ActionController::Live` somewhere 
> the middleware can access it
> * Look at the response object coming back to Rack to see if its class is 
> `ActionController::Live::Response`
> * Look at the `stream` (if available) on the response object returned to 
> Rack to check if it's a `ActionController::Live::Buffer`
>
> All of these ideas seem pretty brittle and liable to break across new 
> versions of Rails and/or new streaming mechanisms that might come along. Is 
> there something I'm missing?
>
> Thanks!
>
> Jason Clark
> @jasonrclark
> New Relic, Ruby Agent engineer
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to