mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 17:34:43 +00:00
Merge pull request #1948 from def-/httpclient-again
Fix body in httpclient
This commit is contained in:
@@ -505,7 +505,7 @@ proc post*(url: string, extraHeaders = "", body = "",
|
||||
else:
|
||||
x
|
||||
|
||||
var xb = mpBody.withNewLine() & body.withNewLine()
|
||||
var xb = mpBody.withNewLine() & body
|
||||
|
||||
var xh = extraHeaders.withNewLine() & mpHeaders.withNewLine() &
|
||||
withNewLine("Content-Length: " & $len(xb))
|
||||
@@ -517,7 +517,7 @@ proc post*(url: string, extraHeaders = "", body = "",
|
||||
if result.status.redirection():
|
||||
let redirectTo = getNewLocation(lastURL, result.headers)
|
||||
var meth = if result.status != "307": httpGet else: httpPost
|
||||
result = request(redirectTo, meth, xh, body, sslContext, timeout,
|
||||
result = request(redirectTo, meth, xh, xb, sslContext, timeout,
|
||||
userAgent, proxy)
|
||||
lastUrl = redirectTo
|
||||
|
||||
|
||||
Reference in New Issue
Block a user