Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

response.content_type in after_filter #5632

Closed
pwim opened this Issue Mar 28, 2012 · 7 comments

Comments

Projects
None yet
4 participants
Contributor

pwim commented Mar 28, 2012

Under Rails 3.1, accessing response.content_type returned "text/html" by default. In Rails 3.2, it returns "" by default.

Member

drogus commented Mar 28, 2012

@pwim can you try this on 3-2-stable or 3.2.3.rc1? See my comments here for help in setting that up: #5626 (comment)

Contributor

kennyj commented Mar 28, 2012

I tried to reproduce this issue, and I saw a similar problem.
The following testcase was failure on master. but that one was success on 3-1-stable.

class FooController < PostsController
  def index
    render :inline => 'test'
  end
end

class FooAfterFiltersTest < ActionController::TestCase
  def test_content_type
    @controller = FooController.new
    process("index")
    assert_equal "text/html", @controller.response.content_type # ★
  end
end

I guess that the above result come from 19433ce#actionpack/lib/action_view/template/handlers/erb.rb (becase we removed default_format??)

Sorry, if this is another problem.

Member

drogus commented Mar 28, 2012

@kennyj what's the content type in your test with :inline?

Contributor

kennyj commented Mar 28, 2012

@drogus the content type is blank.

Member

drogus commented Mar 28, 2012

@pwim does it also fail for you when you render :inline or :text?

Owner

spastorino commented Mar 28, 2012

Can you guys please check against 3-2-3 branch or 3-2-stable?. Thanks.

andhapp pushed a commit to andhapp/rails that referenced this issue Mar 28, 2012

Contributor

pwim commented Mar 29, 2012

Thanks! Rails-3-2 stable now works for me.

rafaelfranca pushed a commit to rafaelfranca/omg-rails that referenced this issue Mar 29, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment