From 906de6fdb5025b6481926b9066151fd399c9870c Mon Sep 17 00:00:00 2001 From: Jiale Zhi Date: Wed, 16 Jul 2014 16:44:00 -0700 Subject: Fix setting multiple cookies bug --- t/sanity.t | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 't') diff --git a/t/sanity.t b/t/sanity.t index 0899a82..1385ebb 100644 --- a/t/sanity.t +++ b/t/sanity.t @@ -235,6 +235,15 @@ Set cookie ngx.log(ngx.ERR, err) return end + + local ok, err = cookie:set({ + key = "ID", value = "0xf7898", + expires = "Wed, 09 Jun 2021 10:18:14 GMT" + }) + if not ok then + ngx.log(ngx.ERR, err) + return + end ngx.say("Set cookie") '; } @@ -242,8 +251,9 @@ Set cookie GET /t --- no_error_log [error] ---- response_headers -Set-Cookie: Name=Bob; Path=/ -Set-Cookie: Age=20 +--- comment +because "--- response_headers" does not work with multiple headers with the same +key, so use "--- raw_response_headers_like" instead +--- raw_response_headers_like: Set-Cookie: Name=Bob; Path=/\r\nSet-Cookie: Age=20\r\nSet-Cookie: ID=0xf7898; Expires=Wed, 09 Jun 2021 10:18:14 GMT --- response_body Set cookie -- cgit v1.2.3-70-g09d2