-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add documentation to ActionDispatch::Request #9698
Conversation
Add documentation to ActionDispatch::Request
The docs look good, thank you. |
Hmm, I am not sure, but yes, that looks funny to me. |
# app.response.fullpath # => "/articles" | ||
# | ||
# app.get "/articles?page=2" | ||
# app.response.fullpath # => "/articles?page=2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.response
? Shouldn't this be .request
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, I think so, yes. Brains are a funny thing. I'll fix that now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argh! Sorry! Obviously hadn't had enough coffee this morning. Just noticed another one…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 5bf6d8e
I'm afraid people will look at the docs and ask themselves: "wtf is app?". I don't think the app should be mentioned in the docs. |
# The +String+ MIME type of the request | ||
# | ||
# app.get "/articles" | ||
# # => "application/x-www-form-urlencoded" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be:
# app.get "/articles"
# app.request.media_type
# # => "application/x-www-form-urlencoded"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in a3c8e4a
@carlosantoniodasilva What instead? |
@steveklabnik I believe @garethrees has tested this in the console, where How about: # # assume a GET to "/articles"
# request.fullpath # => "/articles" Or just removing it seems ok: # get "/articles"
# request.fullpath # => "/articles" Wdyt? |
I'm happy if you're happy. You can go ahead and make that change, I'm done screwing up this simple commit. :) |
Yup. Thought that was a common trick, but I agree it makes less sense when accessing The main reason I was documenting it is because I kept having to check which would give me While we're at it, what does |
@steveklabnik hehe alright :) @garethrees I think it is a common trick, it's just that might not be worth mentioning it in the docs regarding the request methods.
|
I've added some documentation to the following:
ActionDispatch::Request#fullpath
ActionDispatch::Request#original_url
ActionDispatch::Request#media_type
Could someone check that I've explained them correctly?
I also have a question about
Request#media_type
referring to it's documentation.I created a simple blog and used
respond_with
so that the articles index responds to XML and JSON.Here's what I get in the console:
Should I be seeing
application/xml
andapplication/json
respectively?