mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-01 17:41:17 +00:00
bugfix: httpclient
This commit is contained in:
@@ -345,6 +345,11 @@ proc writeContentType*() =
|
||||
write(stdout, "Content-type: text/html\n\n")
|
||||
system.stackTraceNewLine = "<br />\n"
|
||||
|
||||
proc setStackTraceNewLine*() =
|
||||
## Modifies the debug stack traces so that they contain
|
||||
## ``<br />`` and are easily readable in a browser.
|
||||
system.stackTraceNewLine = "<br />\n"
|
||||
|
||||
proc setCookie*(name, value: string) =
|
||||
## Sets a cookie.
|
||||
write(stdout, "Set-Cookie: ", name, "=", value, "\n")
|
||||
|
||||
@@ -238,8 +238,10 @@ proc request*(url: string, httpMethod = httpGET, extraHeaders = "",
|
||||
|
||||
var headers = copy($httpMethod, len("http"))
|
||||
if r.path != "":
|
||||
headers.add(" " & r.path & r.query)
|
||||
headers.add(" / HTTP/1.1\c\L")
|
||||
headers.add(" /" & r.path & r.query)
|
||||
else:
|
||||
headers.add(" /")
|
||||
headers.add(" HTTP/1.1\c\L")
|
||||
|
||||
add(headers, "Host: " & r.hostname & "\c\L")
|
||||
add(headers, extraHeaders)
|
||||
|
||||
Reference in New Issue
Block a user