Skip to content

Commit

Permalink
ensuring to close client after request
Browse files Browse the repository at this point in the history
  • Loading branch information
miki725 committed Feb 15, 2024
1 parent e0ed603 commit eed75bb
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions nimutils/net.nim
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,13 @@ proc safeRequest*(url: Uri | string,
timeout = timeout,
pinnedCert = pinnedCert,
disallowHttp = disallowHttp)
return client.safeRequest(url = uri,
httpMethod = httpMethod,
body = body,
headers = headers,
multipart = multipart,
retries = retries,
firstRetryDelayMs = firstRetryDelayMs)
try:
return client.safeRequest(url = uri,
httpMethod = httpMethod,
body = body,
headers = headers,
multipart = multipart,
retries = retries,
firstRetryDelayMs = firstRetryDelayMs)
finally:
client.close()

0 comments on commit eed75bb

Please sign in to comment.