summary refs log tree commit diff stats
path: root/tests/stdlib/thttpcore.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/stdlib/thttpcore.nim')
-rw-r--r--tests/stdlib/thttpcore.nim27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/stdlib/thttpcore.nim b/tests/stdlib/thttpcore.nim
index 33c24453e..cb1a0875f 100644
--- a/tests/stdlib/thttpcore.nim
+++ b/tests/stdlib/thttpcore.nim
@@ -51,3 +51,30 @@ suite "httpcore":
     doAssert parseHeader("Accept: foo, bar") == (key: "Accept", value: @["foo", "bar"])
     doAssert parseHeader("Accept: foo, bar, prologue") == (key: "Accept", value: @["foo", "bar", "prologue"])
     doAssert parseHeader("Accept: foo, bar, prologue, starlight") == (key: "Accept", value: @["foo", "bar", "prologue", "starlight"])
+
+  test "add empty sequence to HTTP headers":
+    block:
+      var headers = newHttpHeaders()
+      headers["empty"] = @[]
+
+      doAssert not headers.hasKey("empty")
+
+    block:
+      var headers = newHttpHeaders()
+      headers["existing"] = "true"
+      headers["existing"] = @[]
+
+      doAssert not headers.hasKey("existing")
+
+    block:
+      var headers = newHttpHeaders()
+      headers["existing"] = @["true"]
+      headers["existing"] = @[]
+
+      doAssert not headers.hasKey("existing")
+
+    block:
+      var headers = newHttpHeaders()
+      headers["existing"] = @[]
+      headers["existing"] = @["true"]
+      doAssert headers.hasKey("existing")