0
0
Fork 0

Close http connection in perform method of Request class (#6889)

HTTP connections must be explicitly closed in many cases, and letting
perform method close connections makes its callers less redundant and
prevent them from forgetting to close connections.
This commit is contained in:
Akihiko Odaki 2018-03-24 20:49:54 +09:00 committed by Eugen Rochko
parent 4e71b104e6
commit 54b273bf99
15 changed files with 134 additions and 127 deletions

View file

@ -60,9 +60,9 @@ module JsonLdHelper
end
def fetch_resource_without_id_validation(uri)
response = build_request(uri).perform
return if response.code != 200
body_to_json(response.to_s)
build_request(uri).perform do |response|
response.code == 200 ? body_to_json(response.to_s) : nil
end
end
def body_to_json(body)