version 0.8.8

This commit is contained in:
Andreas Rumpf 2010-03-14 01:25:25 +01:00
commit 7bf98411b6
52 changed files with 15732 additions and 6193 deletions

View file

@ -284,14 +284,14 @@ proc post*(url: string, extraHeaders = "", body = "",
## | POST's ``body`` to the ``url`` and returns a ``TResponse`` object.
## | This proc adds the necessary Content-Length header.
## | This proc also handles redirection.
extraHeaders.add("Content-Length: " & $len(body) & "\c\L")
result = request(url, httpPOST, extraHeaders, body)
var xh = extraHeaders & "Content-Length: " & $len(body) & "\c\L"
result = request(url, httpPOST, xh, body)
for i in 1..maxRedirects:
if result.status.redirection():
var locationHeader = result.headers["Location"]
if locationHeader == "": httpError("location header expected")
var meth = if result.status != "307": httpGet else: httpPost
result = request(locationHeader, meth, extraHeaders, body)
result = request(locationHeader, meth, xh, body)
proc postContent*(url: string, extraHeaders = "", body = ""): string =
## | POST's ``body`` to ``url`` and returns the response's body as a string