Merge pull request #1948 from def-/httpclient-again
Fix body in httpclient
This commit is contained in:
commit
c94f5bfb06
1 changed files with 2 additions and 2 deletions
|
|
@ -505,7 +505,7 @@ proc post*(url: string, extraHeaders = "", body = "",
|
||||||
else:
|
else:
|
||||||
x
|
x
|
||||||
|
|
||||||
var xb = mpBody.withNewLine() & body.withNewLine()
|
var xb = mpBody.withNewLine() & body
|
||||||
|
|
||||||
var xh = extraHeaders.withNewLine() & mpHeaders.withNewLine() &
|
var xh = extraHeaders.withNewLine() & mpHeaders.withNewLine() &
|
||||||
withNewLine("Content-Length: " & $len(xb))
|
withNewLine("Content-Length: " & $len(xb))
|
||||||
|
|
@ -517,7 +517,7 @@ proc post*(url: string, extraHeaders = "", body = "",
|
||||||
if result.status.redirection():
|
if result.status.redirection():
|
||||||
let redirectTo = getNewLocation(lastURL, result.headers)
|
let redirectTo = getNewLocation(lastURL, result.headers)
|
||||||
var meth = if result.status != "307": httpGet else: httpPost
|
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)
|
userAgent, proxy)
|
||||||
lastUrl = redirectTo
|
lastUrl = redirectTo
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue