-
Notifications
You must be signed in to change notification settings - Fork 21.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This behaves similarly to REQUEST_URI, but we need to implement it on our own because REQUEST_URI is not reliable. Note that since PATH_INFO does not contain information about trailing question mark, this is not 100% accurate, for example `/foo?` will result in `/foo` in ORIGINAL_FULLPATH
- Loading branch information
Showing
3 changed files
with
54 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require "abstract_unit" | ||
|
||
module ApplicationTests | ||
class BuildOriginalPathTest < Test::Unit::TestCase | ||
def test_include_original_PATH_info_in_ORIGINAL_FULLPATH | ||
env = { 'PATH_INFO' => '/foo/' } | ||
assert_equal "/foo/", Rails.application.send(:build_original_fullpath, env) | ||
end | ||
|
||
def test_include_SCRIPT_NAME | ||
env = { | ||
'SCRIPT_NAME' => '/foo', | ||
'PATH_INFO' => '/bar' | ||
} | ||
|
||
assert_equal "/foo/bar", Rails.application.send(:build_original_fullpath, env) | ||
end | ||
|
||
def test_include_QUERY_STRING | ||
env = { | ||
'PATH_INFO' => '/foo', | ||
'QUERY_STRING' => 'bar', | ||
} | ||
assert_equal "/foo?bar", Rails.application.send(:build_original_fullpath, env) | ||
end | ||
end | ||
end |
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