method
process
v1.2.6 -
Show latest stable
- Class:
ActionController::Integration::Session
process(method, path, parameters=nil, headers=nil)private
Performs the actual request.
# File actionpack/lib/action_controller/integration.rb, line 229
def process(method, path, parameters=nil, headers=nil)
data = requestify(parameters)
path = interpret_uri(path) if path =~ %r{://}
path = "/#{path}" unless path[0] == ?/
@path = path
env = {}
if method == :get
env["QUERY_STRING"] = data
data = nil
end
env.update(
"REQUEST_METHOD" => method.to_s.upcase,
"REQUEST_URI" => path,
"HTTP_HOST" => host,
"REMOTE_ADDR" => remote_addr,
"SERVER_PORT" => (https? ? "443" : "80"),
"CONTENT_TYPE" => "application/x-www-form-urlencoded",
"CONTENT_LENGTH" => data ? data.length.to_s : nil,
"HTTP_COOKIE" => encode_cookies,
"HTTPS" => https? ? "on" : "off",
"HTTP_ACCEPT" => accept
)
(headers || {}).each do |key, value|
key = key.to_s.upcase.gsub(/-/, "_")
key = "HTTP_#{key}" unless env.has_key?(key) || key =~ /^HTTP_/
env[key] = value
end
unless ActionController::Base.respond_to?(:clear_last_instantiation!)
ActionController::Base.send(:include, ControllerCapture)
end
ActionController::Base.clear_last_instantiation!
cgi = MockCGI.new(env, data)
Dispatcher.dispatch(cgi, ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, cgi.stdoutput)
@result = cgi.stdoutput.string
@controller = ActionController::Base.last_instantiation
@request = @controller.request
@response = @controller.response
# Decorate the response with the standard behavior of the TestResponse
# so that things like assert_response can be used in integration
# tests.
@response.extend(TestResponseBehavior)
@html_document = nil
parse_result
return status
end Related methods
- Instance methods
- delete
- follow_redirect!
- get
- get_via_redirect
- head
- host!
- https!
- https?
- post
- post_via_redirect
- put
- redirect?
- reset!
- url_for
- xhr
- xml_http_request
- Class methods
- new
- Private methods
-
encode_cookies -
generic_url_rewriter -
interpret_uri -
name_with_prefix -
parse_result -
process -
requestify