diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2017-08-01 16:59:37 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2017-08-01 16:59:37 -0500 |
commit | e473946d58cfdab0b16cf91cdad6bef23fcfafc3 (patch) | |
tree | 8381b3ddd0fca7ef6e9cb7f79aa53a768ecbf376 /actionpack/test/dispatch/routing_test.rb | |
parent | 3d3ec20a485a109bb772cb37382040e25f5d0ded (diff) | |
parent | f9a43f28c087f8ffd35ff7c33a60c938b60f2be2 (diff) | |
download | rails-e473946d58cfdab0b16cf91cdad6bef23fcfafc3.tar.gz rails-e473946d58cfdab0b16cf91cdad6bef23fcfafc3.tar.bz2 rails-e473946d58cfdab0b16cf91cdad6bef23fcfafc3.zip |
Merge branch 'master' into active-storage-import
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 1af0edc1d3..446b65a9b9 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -4416,39 +4416,49 @@ end class TestInvalidUrls < ActionDispatch::IntegrationTest class FooController < ActionController::Base + def self.binary_params_for?(action) + action == "show" + end + def show render plain: "foo#show" end end - test "invalid UTF-8 encoding is treated as ASCII 8BIT encode" do + test "invalid UTF-8 encoding returns a bad request" do with_routing do |set| set.draw do get "/bar/:id", to: redirect("/foo/show/%{id}") - get "/foo/show(/:id)", to: "test_invalid_urls/foo#show" ok = lambda { |env| [200, { "Content-Type" => "text/plain" }, []] } get "/foobar/:id", to: ok ActiveSupport::Deprecation.silence do - get "/foo(/:action(/:id))", controller: "test_invalid_urls/foo" get "/:controller(/:action(/:id))" end end get "/%E2%EF%BF%BD%A6" - assert_response :not_found + assert_response :bad_request get "/foo/%E2%EF%BF%BD%A6" - assert_response :not_found - - get "/foo/show/%E2%EF%BF%BD%A6" - assert_response :ok + assert_response :bad_request get "/bar/%E2%EF%BF%BD%A6" - assert_response :redirect + assert_response :bad_request get "/foobar/%E2%EF%BF%BD%A6" + assert_response :bad_request + end + end + + test "params encoded with binary_params_for? are treated as ASCII 8bit" do + with_routing do |set| + set.draw do + get "/foo/show(/:id)", to: "test_invalid_urls/foo#show" + end + + get "/foo/show/%E2%EF%BF%BD%A6" assert_response :ok end end |