module ActionDispatch::Integration::RequestHelpers

def delete(path, parameters = nil, headers_or_env = nil)

more details.
Performs a DELETE request with the given parameters. See +#get+ for
def delete(path, parameters = nil, headers_or_env = nil)
  process :delete, path, parameters, headers_or_env
end

def delete_via_redirect(path, parameters = nil, headers_or_env = nil)

See +request_via_redirect+ for more information.
Performs a DELETE request, following any subsequent redirect.
def delete_via_redirect(path, parameters = nil, headers_or_env = nil)
  request_via_redirect(:delete, path, parameters, headers_or_env)
end

def follow_redirect!

performed on the location header.
redirect, an exception will be raised. Otherwise, the redirect is
Follow a single redirect response. If the last response was not a
def follow_redirect!
  raise "not a redirect! #{status} #{status_message}" unless redirect?
  get(response.location)
  status
end

def get(path, parameters = nil, headers_or_env = nil)

+#post+, +#patch+, +#put+, +#delete+, and +#head+.
You can also perform POST, PATCH, PUT, DELETE, and HEAD requests with

response object.
object's @response instance variable will point to the same
called from an ActionDispatch::IntegrationTest object, then that
inspect the details of the response. Furthermore, if this method was
This method returns a Response object, which one can use to

merged into the Rack env hash.
- +headers_or_env+: Additional headers to pass, as a Hash. The headers will be
multipart/form-data).
(application/x-www-form-urlencoded or
a Hash, or a String that is appropriately encoded
be +nil+,
- +parameters+: The HTTP parameters that you want to pass. This may
request.
- +path+: The URI (as a String) on which you want to perform a GET

Performs a GET request with the given parameters.
def get(path, parameters = nil, headers_or_env = nil)
  process :get, path, parameters, headers_or_env
end

def get_via_redirect(path, parameters = nil, headers_or_env = nil)

See +request_via_redirect+ for more information.
Performs a GET request, following any subsequent redirect.
def get_via_redirect(path, parameters = nil, headers_or_env = nil)
  request_via_redirect(:get, path, parameters, headers_or_env)
end

def head(path, parameters = nil, headers_or_env = nil)

details.
Performs a HEAD request with the given parameters. See +#get+ for more
def head(path, parameters = nil, headers_or_env = nil)
  process :head, path, parameters, headers_or_env
end

def patch(path, parameters = nil, headers_or_env = nil)

details.
Performs a PATCH request with the given parameters. See +#get+ for more
def patch(path, parameters = nil, headers_or_env = nil)
  process :patch, path, parameters, headers_or_env
end

def patch_via_redirect(path, parameters = nil, headers_or_env = nil)

See +request_via_redirect+ for more information.
Performs a PATCH request, following any subsequent redirect.
def patch_via_redirect(path, parameters = nil, headers_or_env = nil)
  request_via_redirect(:patch, path, parameters, headers_or_env)
end

def post(path, parameters = nil, headers_or_env = nil)

details.
Performs a POST request with the given parameters. See +#get+ for more
def post(path, parameters = nil, headers_or_env = nil)
  process :post, path, parameters, headers_or_env
end

def post_via_redirect(path, parameters = nil, headers_or_env = nil)

See +request_via_redirect+ for more information.
Performs a POST request, following any subsequent redirect.
def post_via_redirect(path, parameters = nil, headers_or_env = nil)
  request_via_redirect(:post, path, parameters, headers_or_env)
end

def put(path, parameters = nil, headers_or_env = nil)

details.
Performs a PUT request with the given parameters. See +#get+ for more
def put(path, parameters = nil, headers_or_env = nil)
  process :put, path, parameters, headers_or_env
end

def put_via_redirect(path, parameters = nil, headers_or_env = nil)

See +request_via_redirect+ for more information.
Performs a PUT request, following any subsequent redirect.
def put_via_redirect(path, parameters = nil, headers_or_env = nil)
  request_via_redirect(:put, path, parameters, headers_or_env)
end

def request_via_redirect(http_method, path, parameters = nil, headers_or_env = nil)

redirect loops back to itself.
not a redirect--this means you may run into an infinite loop if your
redirect. Note that the redirects are followed until the response is
Performs a request using the specified method, following any subsequent
def request_via_redirect(http_method, path, parameters = nil, headers_or_env = nil)
  process(http_method, path, parameters, headers_or_env)
  follow_redirect! while redirect?
  status
end

def xml_http_request(request_method, path, parameters = nil, headers_or_env = nil)

string; the headers are a hash.
+:head+; the parameters are +nil+, a hash, or a url-encoded or multipart
The request_method is +:get+, +:post+, +:patch+, +:put+, +:delete+ or

a request from the Prototype library.
Performs an XMLHttpRequest request with the given parameters, mirroring
def xml_http_request(request_method, path, parameters = nil, headers_or_env = nil)
  headers_or_env ||= {}
  headers_or_env['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'
  headers_or_env['HTTP_ACCEPT'] ||= [Mime::JS, Mime::HTML, Mime::XML, 'text/xml', Mime::ALL].join(', ')
  process(request_method, path, parameters, headers_or_env)
end