2009-12-22 18:11:21 -05:00
|
|
|
require 'action_dispatch/http/request'
|
|
|
|
require 'action_dispatch/http/response'
|
|
|
|
|
2009-05-27 04:40:43 -04:00
|
|
|
module ActionController
|
2009-12-20 21:05:26 -05:00
|
|
|
module RackDelegation
|
2009-05-28 12:35:36 -04:00
|
|
|
extend ActiveSupport::Concern
|
2009-05-28 10:49:02 -04:00
|
|
|
|
2014-02-28 19:39:22 -05:00
|
|
|
delegate :headers, :status=, :location=, :content_type=,
|
2014-05-15 10:08:53 -04:00
|
|
|
:status, :location, :content_type, :_status_code, :to => "@_response"
|
2009-05-28 10:49:02 -04:00
|
|
|
|
2012-07-02 14:41:28 -04:00
|
|
|
def dispatch(action, request)
|
2012-07-02 17:01:42 -04:00
|
|
|
set_response!(request)
|
2010-06-02 16:56:41 -04:00
|
|
|
super(action, request)
|
2009-05-27 04:40:43 -04:00
|
|
|
end
|
2009-05-28 10:49:02 -04:00
|
|
|
|
2009-05-27 04:40:43 -04:00
|
|
|
def response_body=(body)
|
|
|
|
response.body = body if response
|
|
|
|
super
|
|
|
|
end
|
2009-12-21 18:29:59 -05:00
|
|
|
|
|
|
|
def reset_session
|
|
|
|
@_request.reset_session
|
|
|
|
end
|
2012-07-02 17:01:42 -04:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def set_response!(request)
|
|
|
|
@_response = ActionDispatch::Response.new
|
|
|
|
@_response.request = request
|
|
|
|
end
|
2009-05-27 04:40:43 -04:00
|
|
|
end
|
2009-05-28 10:49:02 -04:00
|
|
|
end
|