diff options
author | Dominik Picheta <dominikpicheta@gmail.com> | 2017-02-13 21:14:29 +0100 |
---|---|---|
committer | Dominik Picheta <dominikpicheta@gmail.com> | 2017-02-13 21:14:29 +0100 |
commit | a336bf2395cc7915d669c2e3c0e870bf97f5401e (patch) | |
tree | 1eeea33086bca5159c4e7377d1e7866df86d2392 /lib | |
parent | 92665e6e9a74995bd108da5bf3668e2c09c8d79c (diff) | |
download | Nim-a336bf2395cc7915d669c2e3c0e870bf97f5401e.tar.gz |
Fixes parseHeader("foo:") != ("foo", @[""]). Refs #5344.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/httpcore.nim | 6 |
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 |