Skip to content
This repository
Browse code

Only show dump of regular env methods on exception screen (not all th…

…e rack crap) [DHH]
  • Loading branch information...
commit 5b8801442ea02fc942ae0ee8ef81a9120525f5f0 1 parent 9f06297
David Heinemeier Hansson authored May 04, 2011
2  actionpack/CHANGELOG
... ...
@@ -1,5 +1,7 @@
1 1
 *Rails 3.1.0 (unreleased)*
2 2
 
  3
+* Only show dump of regular env methods on exception screen (not all the rack crap) [DHH]
  4
+
3 5
 * auto_link has been removed with no replacement.  If you still use auto_link
4 6
   please install the rails_autolink gem:
5 7
     http://github.com/tenderlove/rails_autolink
9  actionpack/lib/action_dispatch/http/request.rb
@@ -17,16 +17,17 @@ class Request < Rack::Request
17 17
     include ActionDispatch::Http::Upload
18 18
     include ActionDispatch::Http::URL
19 19
 
20  
-    LOCALHOST = [/^127\.0\.0\.\d{1,3}$/, "::1", /^0:0:0:0:0:0:0:1(%.*)?$/].freeze
21  
-
22  
-    %w[ AUTH_TYPE GATEWAY_INTERFACE
  20
+    LOCALHOST   = [/^127\.0\.0\.\d{1,3}$/, "::1", /^0:0:0:0:0:0:0:1(%.*)?$/].freeze
  21
+    ENV_METHODS = %w[ AUTH_TYPE GATEWAY_INTERFACE
23 22
         PATH_TRANSLATED REMOTE_HOST
24 23
         REMOTE_IDENT REMOTE_USER REMOTE_ADDR
25 24
         SERVER_NAME SERVER_PROTOCOL
26 25
 
27 26
         HTTP_ACCEPT HTTP_ACCEPT_CHARSET HTTP_ACCEPT_ENCODING
28 27
         HTTP_ACCEPT_LANGUAGE HTTP_CACHE_CONTROL HTTP_FROM
29  
-        HTTP_NEGOTIATE HTTP_PRAGMA ].each do |env|
  28
+        HTTP_NEGOTIATE HTTP_PRAGMA ].freeze
  29
+      
  30
+    ENV_METHODS.each do |env|
30 31
       class_eval <<-METHOD, __FILE__, __LINE__ + 1
31 32
         def #{env.sub(/^HTTP_/n, '').downcase}
32 33
           @env["#{env}"]
2  actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb
@@ -24,7 +24,7 @@
24 24
 <div id="session_dump" style="display:none"><pre><%= debug_hash @request.session %></pre></div>
25 25
 
26 26
 <p><a href="#" onclick="document.getElementById('env_dump').style.display='block'; return false;">Show env dump</a></p>
27  
-<div id="env_dump" style="display:none"><pre><%= debug_hash @request.env %></pre></div>
  27
+<div id="env_dump" style="display:none"><pre><%= debug_hash @request.env.slice(*@request.class::ENV_METHODS) %></pre></div>
28 28
 
29 29
 
30 30
 <h2 style="margin-top: 30px">Response</h2>

2 notes on commit 5b88014

José Valim
Owner

@spastorino, please don't forget to push this to exceptron as well!

Santiago Pastorino
Owner

I did that yesterday bro ;). Anyways I run the tests and are failing, I have to review what else have changed :(.

Please sign in to comment.
Something went wrong with that request. Please try again.