Skip to content

Commit

Permalink
Merge pull request #19291 from hired/return-truthy-value-from-head
Browse files Browse the repository at this point in the history
Return truthy value from head method
  • Loading branch information
rafaelfranca committed Mar 13, 2015
1 parent 2e26bf1 commit 5d227e6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/head.rb
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
Expand Up @@ -217,6 +217,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 @@ -576,4 +581,10 @@ 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

0 comments on commit 5d227e6

Please sign in to comment.