Merge pull request #1948 from def-/httpclient-again

Fix body in httpclient
This commit is contained in:
Dominik Picheta
2015-01-13 19:31:25 +00:00

View File

@@ -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