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:
parent
4e71b104e6
commit
54b273bf99
15 changed files with 134 additions and 127 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue