diff options
Diffstat (limited to 'actionpack/lib')
-rwxr-xr-x | actionpack/lib/action_controller/request.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/request.rb b/actionpack/lib/action_controller/request.rb index 6e73a69ed7..032b19d6eb 100755 --- a/actionpack/lib/action_controller/request.rb +++ b/actionpack/lib/action_controller/request.rb @@ -122,6 +122,14 @@ module ActionController @path_parameters ||= {} end + # Returns true if the request's "X-Requested-With" header contains + # "XMLHttpRequest". (The Prototype Javascript library sends this header with + # every Ajax request.) + def xml_http_request? + env['HTTP_X_REQUESTED_WITH'] =~ /XMLHttpRequest/i + end + alias xhr? :xml_http_request? + #-- # Must be implemented in the concrete request #++ |