]> gitweb.factorcode.org Git - factor.git/commitdiff
http: simpler stack effects, adding a test case.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 12 Mar 2021 16:32:46 +0000 (08:32 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 12 Mar 2021 16:32:46 +0000 (08:32 -0800)
basis/http/http-tests.factor
basis/http/http.factor

index fc6a896c653c641c18a7c797dad92635a03b9246..0d136bc63c309277f2ef20b2dd118793e01489b3 100644 (file)
@@ -173,6 +173,17 @@ ${ read-response-test-1' } [
     dup parse-set-cookie first unparse-set-cookie =
 ] unit-test
 
+{
+    {
+        T{ cookie
+            { name "lang" }
+            { value "en-US" }
+            { path "/" }
+            { domain "example.com" }
+        }
+    }
+} [ "lang=en-US; Path=/; Domain=example.com" parse-set-cookie ] unit-test
+
 { t } [
     "a="
     dup parse-set-cookie first unparse-set-cookie =
index 0f5eff158a09a564671ccead2f00c920efff52f1..e0f8528f8dbbd7fd561932ed909848be358c8ddf 100644 (file)
@@ -52,7 +52,7 @@ TUPLE: cookie name value version comment path domain expires max-age http-only s
         f swap
         (parse-set-cookie)
         [
-            over >lower [ swapd ] dip {
+            swapd pick >lower {
                 { "version" [ >>version ] }
                 { "comment" [ >>comment ] }
                 { "expires" [ [ cookie-string>timestamp >>expires ] unless-empty ] }
@@ -62,8 +62,7 @@ TUPLE: cookie name value version comment path domain expires max-age http-only s
                 { "httponly" [ drop t >>http-only ] }
                 { "secure" [ drop t >>secure ] }
                 [ drop rot <cookie> dup , ]
-            } case
-            nip
+            } case nip
         ] assoc-each
         drop
     ] { } make ;