Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit 523c674

Browse files
committed
tests: set all fetch() params in test_redirect_limit
The default values of body and headers ought to be "nil", but in fact they end up as the string "0" in test_redirect_limit. This causes all sorts of problems. When body is defined as "0", we follow the conditional that leads us to conn.request_post instead of conn.request_get, and request_post crashes since it expects a key-value string instead of simply "0". The unexpected string for the headers variable wreaks havoc as well; when headers is "0", the hash value assignment at the beginning of fetch() fails, because Ruby can't convert the string to a hash. I'm not sure why these values are "0" instead of nil, but setting them explicitly during the call fixes the bug.
1 parent 14160d2 commit 523c674

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

test/test_fetchers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def test_redirect_limit
244244
@_redirect_counter = 0
245245
uri = _uri_build('/redirect_loop')
246246
assert_raises(OpenID::HTTPRedirectLimitReached) {
247-
@fetcher.fetch(uri, redirect_limit=0)
247+
@fetcher.fetch(uri, body=nil, headers=nil, redirect_limit=0)
248248
}
249249
end
250250

0 commit comments

Comments
 (0)