Merge pull request #5080 from FedericoCeratto/httpheaders

Add HTTP header deletion, improve tests
This commit is contained in:
Dominik Picheta 2016-12-01 18:01:04 +01:00 • committed by GitHub
commit d6ab21eed5
2 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,28 @@
import unittest
import httpcore
suite "httpcore":
test "HttpCode":
assert $Http418 == "418 I'm a teapot"
assert Http418.is4xx() == true
assert Http418.is2xx() == false
test "headers":
var h = newHttpHeaders()
assert h.len == 0
h.add("Cookie", "foo")
assert h.len == 1
assert h.hasKey("cooKIE")
assert h["Cookie"] == "foo"
assert h["cookie"] == "foo"
h["cookie"] = @["bar", "x"]
assert h["Cookie"] == "bar"
assert h["Cookie", 1] == "x"
assert h["Cookie"].contains("BaR") == true
assert h["Cookie"].contains("X") == true
assert "baR" in h["cookiE"]
h.del("coOKie")
assert h.len == 0