summary refs log tree commit diff stats
path: root/lib/pure/httpcore.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pure/httpcore.nim')
-rw-r--r--lib/pure/httpcore.nim6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/pure/httpcore.nim b/lib/pure/httpcore.nim
index d7f720f66..aa8f1958d 100644
--- a/lib/pure/httpcore.nim
+++ b/lib/pure/httpcore.nim
@@ -206,6 +206,8 @@ proc parseHeader*(line: string): tuple[key: string, value: seq[string]] =
   inc(i) # skip :
   if i < len(line):
     i += parseList(line, result.value, i)
+  elif result.key.len > 0:
+    result.value = @[""]
   else:
     result.value = @[]
 
@@ -318,4 +320,6 @@ when isMainModule:
   let (key, value) = parseHeader("foobar: ")
   test = newHttpHeaders()
   test[key] = value
-  doAssert test["foobar"] == ""
\ No newline at end of file
+  doAssert test["foobar"] == ""
+
+  doAssert parseHeader("foobar:") == ("foobar", @[""])
\ No newline at end of file