Merge pull request #1897 from hannesrichter/fix/urequest-close

fix: added missing close() of socket object.
This commit is contained in:
Ibrahim Abdelkader 2023-07-13 01:08:16 +03:00 committed by GitHub
commit 4e2cf970b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -171,8 +171,9 @@ def request(method, url, data=None, json=None, files=None, headers={}, auth=None
resp_headers = b"\r\n".join(resp_headers)
content = b"\r\n".join(response)
except OSError:
s.close()
raise
finally:
s.close()
return Response(resp_code, resp_reason, resp_headers, content)