Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8625

Show
Ignore:
Timestamp:
01/11/08 06:39:56 (4 months ago)
Author:
nzkoz
Message:

Provide a nicer way to access headers. request.headersContent-Type? instead of request.headersHTTP_CONTENT_TYPE? [Koz]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r8616 r8625  
    11*SVN* 
     2 
     3* Provide nicer access to HTTP Headers.  Instead of request.env["HTTP_REFERRER"] you can now use request.headers["Referrer"]. [Koz] 
    24 
    35* UrlWriter respects relative_url_root.  #10748 [Cheah Chu Yeow] 
  • trunk/actionpack/lib/action_controller.rb

    r7592 r8625  
    5656require 'action_controller/record_identifier' 
    5757require 'action_controller/request_forgery_protection' 
     58require 'action_controller/headers' 
    5859 
    5960require 'action_view' 
  • trunk/actionpack/lib/action_controller/request.rb

    r8492 r8625  
    6262    end 
    6363 
     64    # Provides acccess to the request's HTTP headers, for example: 
     65    #  request.headers["Content-Type"] # => "text/plain" 
    6466    def headers 
    65       @env 
     67      @headers ||= ActionController::Http::Headers.new(@env) 
    6668    end 
    6769