Skip to content
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

if format is unknown NullMimeTypeObject is returned #8084

Merged
merged 1 commit into from
Oct 31, 2012

Conversation

acapilleri
Copy link
Contributor

If a unknown format is passed in a request, the methods html?, xml?, json? ...etc
Nil Exception.

This patch add a class NullMimeTypeObject, that is returned when request.format is unknown
and it responds false to the methods that ends with '?'.

It refers to #7837, not fixes because it's not considered a improvement not a bug.

@acapilleri
Copy link
Contributor Author

cc / @guilleiguaran

request.expects(:parameters).at_least_once.returns({ :format => :hello })
assert_equal request.format.html?, false
assert_equal request.format.xml?, false
assert_equal request.format.json?, false

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong indent. Can use new hash style, and can test using assert !request.format.html?

@carlosantoniodasilva
Copy link
Member

@acapilleri a changelog entry is also welcome :). Thanks

If a unknown format is passed in a request, the methods html?, xml?, json? ...etc
Nil Exception.

This patch add a class NullMimeTypeObject, that is returned when  request.format is unknown
and it responds false to the methods that ends with '?'.

It refers to rails#7837, not fixes because it's not considered a improvement not a bug.
rafaelfranca added a commit that referenced this pull request Oct 31, 2012
if format is unknown NullMimeTypeObject is returned
@rafaelfranca rafaelfranca merged commit 6a6909d into rails:master Oct 31, 2012
@carlosantoniodasilva
Copy link
Member

Hey mate, this has broken the build, some Action Pack failures, can you please take a look? Thanks!

@acapilleri
Copy link
Contributor Author

ok...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants