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

Return truthy value from head method #19291

Merged
merged 1 commit into from
Mar 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/head.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ def head(status, options = {})
headers.delete('Content-Type')
headers.delete('Content-Length')
end

true
end

private
Expand Down
11 changes: 11 additions & 0 deletions actionpack/test/controller/render_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ def head_with_status_code_first
head :forbidden, :x_custom_header => "something"
end

def head_and_return
head :ok and return
raise 'should not reach this line'
end

def head_with_no_content
# Fill in the headers with dummy data to make
# sure they get removed during the testing
Expand Down Expand Up @@ -560,6 +565,12 @@ def test_head_with_status_code_first
assert_equal "something", @response.headers["X-Custom-Header"]
assert_response :forbidden
end

def test_head_returns_truthy_value
assert_nothing_raised do
get :head_and_return
end
end
end

class HttpCacheForeverTest < ActionController::TestCase
Expand Down