Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make process reuse the env var passed as argument
- Loading branch information
1 parent
0c5aded
commit 0e4748c
Showing
2 changed files
with
12 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -243,7 +243,8 @@ def _mock_session | |
end | ||
|
||
# Performs the actual request. | ||
def process(method, path, parameters = nil, rack_environment = nil) | ||
def process(method, path, parameters = nil, env = nil) | ||
env ||= {} | ||
if path =~ %r{://} | ||
location = URI.parse(path) | ||
https! URI::HTTPS === location if location.scheme | ||
|
@@ -259,7 +260,7 @@ def process(method, path, parameters = nil, rack_environment = nil) | |
|
||
hostname, port = host.split(':') | ||
|
||
env = { | ||
default_env = { | ||
:method => method, | ||
:params => parameters, | ||
|
||
|
@@ -277,9 +278,7 @@ def process(method, path, parameters = nil, rack_environment = nil) | |
|
||
session = Rack::Test::Session.new(_mock_session) | ||
|
||
(rack_environment || {}).each do |key, value| | ||
env[key] = value | ||
end | ||
env.reverse_merge!(default_env) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
spastorino
Author
Contributor
|
||
|
||
# NOTE: rack-test v0.5 doesn't build a default uri correctly | ||
# Make sure requested path is always a full uri | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This destructively modifies parameters passed into
process
and in turn intoget
/put/
/etc. methods - not good :)