diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb
index <HASH>..<HASH> 100644
--- a/actionpack/lib/action_dispatch/testing/integration.rb
+++ b/actionpack/lib/action_dispatch/testing/integration.rb
@@ -336,7 +336,7 @@ module ActionDispatch
             end
             path = request_encoder.append_format_to location.path
             path = location.query ? "#{path}?#{location.query}" : path
-          elsif !as.nil?
+          elsif as
             location = URI.parse(path)
             path = request_encoder.append_format_to location.path
             path = location.query ? "#{path}?#{location.query}" : path
Simplify `as` passed check.

`if !var.nil?` is the same as just `if var`