Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move header injection back into integration tests

  • Loading branch information...
commit d63b42da362d696398fd371815734cb0caed48df 1 parent afa7d7f
@josh josh authored
View
7 actionpack/lib/action_controller/testing/integration.rb
@@ -263,7 +263,6 @@ def process(method, path, parameters = nil, headers = nil)
opts = {
:method => method.to_s.upcase,
:params => parameters,
- :headers => headers,
"SERVER_NAME" => host,
"SERVER_PORT" => (https? ? "443" : "80"),
@@ -282,6 +281,12 @@ def process(method, path, parameters = nil, headers = nil)
}
env = ActionDispatch::Test::MockRequest.env_for(@path, opts)
+ (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
+
app = Rack::Lint.new(@app)
status, headers, body = app.call(env)
response = ::Rack::MockResponse.new(status, headers, body)
View
12 actionpack/lib/action_dispatch/test/mock.rb
@@ -5,8 +5,6 @@ class MockRequest < Rack::MockRequest
class << self
def env_for(path, opts)
- headers = opts.delete(:headers)
-
method = (opts[:method] || opts["REQUEST_METHOD"]).to_s.upcase
opts[:method] = opts["REQUEST_METHOD"] = method
@@ -48,15 +46,7 @@ def env_for(path, opts)
uri.query = requestify(params)
end
- env = ::Rack::MockRequest.env_for(uri.to_s, opts)
-
- (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
-
- env
+ ::Rack::MockRequest.env_for(uri.to_s, opts)
end
private
Please sign in to comment.
Something went wrong with that request. Please try again.