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

Commit 3540a51

Browse files
committed
Avoid using Net::HTTPResponse#body=
It's not available before ruby 1.9.1 p378. Use OpenID::HTTPResponse instead.
1 parent be2bab5 commit 3540a51

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

lib/openid/fetchers.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,6 @@ def fetch(url, body=nil, headers=nil, redirect_limit=REDIRECT_LIMIT)
215215
conn.request_post(url.request_uri, body, headers, &body_size_limitter)
216216
end
217217
}
218-
response.body = whole_body
219-
setup_encoding(response)
220218
rescue Timeout::Error => why
221219
raise FetchingError, "Error fetching #{url}: #{why}"
222220
rescue RuntimeError => why
@@ -243,7 +241,10 @@ def fetch(url, body=nil, headers=nil, redirect_limit=REDIRECT_LIMIT)
243241
raise FetchingError, "Error encountered in redirect from #{url}: #{why}"
244242
end
245243
else
246-
return HTTPResponse._from_net_response(response, unparsed_url)
244+
response = HTTPResponse._from_net_response(response, unparsed_url)
245+
response.body = whole_body
246+
setup_encoding(response)
247+
return response
247248
end
248249
end
249250

0 commit comments

Comments
 (0)