aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJiale Zhi <vipcalio@gmail.com>2013-10-29 12:49:23 -0700
committerJiale Zhi <vipcalio@gmail.com>2013-10-29 12:49:23 -0700
commita51034eda320f13eca2e0f05a0a17459d907d90e (patch)
tree3695ec33d40c24b0a675cc2afb58895575b82841 /t
parentb4f8a86cd6ea00c13c7604c959c2f993e5e4e2cb (diff)
downloadlua-resty-cookie-a51034eda320f13eca2e0f05a0a17459d907d90e.tar.gz
lua-resty-cookie-a51034eda320f13eca2e0f05a0a17459d907d90e.tar.bz2
lua-resty-cookie-a51034eda320f13eca2e0f05a0a17459d907d90e.zip
Deal with white space and tabs in cookie
Diffstat (limited to 't')
-rw-r--r--t/sanity.t27
1 files changed, 27 insertions, 0 deletions
diff --git a/t/sanity.t b/t/sanity.t
index bc52348..eb2086a 100644
--- a/t/sanity.t
+++ b/t/sanity.t
@@ -77,6 +77,7 @@ Cookie: SID=31d4d96e407aad42; lang=en-US
lang => en-US
+
=== TEST 3: no cookie header
--- http_config eval: $::HttpConfig
--- config
@@ -100,6 +101,7 @@ no cookie found in current request
--- response_body
+
=== TEST 4: empty value
--- http_config eval: $::HttpConfig
--- config
@@ -127,3 +129,28 @@ Cookie: SID=
SID =>
+
+=== TEST 5: cookie with space/tab
+--- http_config eval: $::HttpConfig
+--- config
+ location /t {
+ content_by_lua '
+ local ck = require "resty.cookie"
+ local cookie, err = ck:new()
+ if not cookie then
+ ngx.log(ngx.ERR, err)
+ return
+ end
+
+ local fields = cookie:get_all()
+
+ for k, v in pairs(fields) do
+ ngx.say(k, " => ", v)
+ end
+ ';
+ }
+--- request
+GET /t
+--- more_headers eval: "Cookie: SID=foo\t"
+--- response_body
+SID => foo