Skip to content

Commit

Permalink
send download errors as text/plain
Browse files Browse the repository at this point in the history
  • Loading branch information
cfillion committed Oct 6, 2014
1 parent f953ef7 commit b5366c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/middle_squid/helpers.rb
Expand Up @@ -62,7 +62,11 @@ def download_like(request, uri)
}

http.errback {
fiber.resume [520, {}, "[MiddleSquid] #{http.error}"]
fiber.resume [
520,
{'Content-Type' => 'text/plain'},
"[MiddleSquid] #{http.error}"
]
}

Fiber.yield
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Expand Up @@ -70,7 +70,7 @@ def test_download_error
assert_requested stub

assert_equal 520, status
assert_empty headers
assert_equal({'Content-Type' => 'text/plain'}, headers)
assert_equal '[MiddleSquid] WebMock timeout error', body
end
end

0 comments on commit b5366c4

Please sign in to comment.