Permalink
Browse files

Merge pull request #9698 from garethrees/request_documentation

Add documentation to ActionDispatch::Request
  • Loading branch information...
2 parents a0920bc + f4d9f33 commit 02caa0252736190dba41484f406c702e5069a0a6 @steveklabnik steveklabnik committed Mar 13, 2013
Showing with 16 additions and 0 deletions.
  1. +16 −0 actionpack/lib/action_dispatch/http/request.rb
@@ -156,14 +156,30 @@ def original_fullpath
@original_fullpath ||= (env["ORIGINAL_FULLPATH"] || fullpath)
end
+ # Returns the +String+ full path including params of the last URL requested.
+ #
+ # app.get "/articles"
+ # app.response.fullpath # => "/articles"
+ #
+ # app.get "/articles?page=2"
+ # app.response.fullpath # => "/articles?page=2"
def fullpath
@fullpath ||= super
end
+ # Returns the original request URL as a +String+
+ #
+ # app.get "/articles?page=2"
+ # app.request.original_url
+ # # => "http://www.example.com/articles?page=2"
def original_url
base_url + original_fullpath
end
+ # The +String+ MIME type of the request
+ #
+ # app.get "/articles"
+ # # => "application/x-www-form-urlencoded"
def media_type
content_mime_type.to_s
end

0 comments on commit 02caa02

Please sign in to comment.