diff options
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/httpclient.nim | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/pure/httpclient.nim b/lib/pure/httpclient.nim index bc964861d..37bc5d8f4 100644 --- a/lib/pure/httpclient.nim +++ b/lib/pure/httpclient.nim @@ -423,6 +423,7 @@ proc request*(url: string, httpMethod: string, extraHeaders = "", add(headers, extraHeaders) add(headers, "\c\L") var s = newSocket() + defer: s.close() if s == nil: raiseOSError(osLastError()) var port = net.Port(80) if r.scheme == "https": @@ -444,7 +445,6 @@ proc request*(url: string, httpMethod: string, extraHeaders = "", s.send(body) result = parseResponse(s, httpMethod != "httpHEAD", timeout) - s.close() proc request*(url: string, httpMethod = httpGET, extraHeaders = "", body = "", sslContext = defaultSSLContext, timeout = -1, |