diff options
author | José Valim <jose.valim@gmail.com> | 2011-10-19 22:09:36 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-10-19 22:09:36 +0200 |
commit | f1fecd9b4e38c289b678bc2aadb406265963c528 (patch) | |
tree | 2f71b7ef228ea6081cab3b2c639b6c2b52252616 /actionpack/lib/action_dispatch/middleware | |
parent | 18dbfcb36369ebb800a22325f689ff4cf27ef467 (diff) | |
download | rails-f1fecd9b4e38c289b678bc2aadb406265963c528.tar.gz rails-f1fecd9b4e38c289b678bc2aadb406265963c528.tar.bz2 rails-f1fecd9b4e38c289b678bc2aadb406265963c528.zip |
Make tests run on 1.8.x, add integration setup.
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/request_id.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/request_id.rb b/actionpack/lib/action_dispatch/middleware/request_id.rb index 4728e9f71e..f4d721f9bf 100644 --- a/actionpack/lib/action_dispatch/middleware/request_id.rb +++ b/actionpack/lib/action_dispatch/middleware/request_id.rb @@ -18,20 +18,19 @@ module ActionDispatch def call(env) env["action_dispatch.request_id"] = external_request_id(env) || internal_request_id - status, headers, body = @app.call(env) headers["X-Request-Id"] = env["action_dispatch.request_id"] [ status, headers, body ] end - + private def external_request_id(env) if env["HTTP_X_REQUEST_ID"].present? env["HTTP_X_REQUEST_ID"].gsub(/[^\w\d\-]/, "").first(255) end end - + def internal_request_id SecureRandom.hex(16) end |