cgi: fix for LH{ } changes.

db4
John Benediktsson 2015-11-04 13:06:23 -08:00
parent 02c4ec3630
commit d211bee38b
2 changed files with 12 additions and 14 deletions

View File

@ -1,19 +1,17 @@
! Copyright (C) 2009 John Benediktsson ! Copyright (C) 2009 John Benediktsson
! See http://factorcode.org/license.txt for BSD license ! See http://factorcode.org/license.txt for BSD license
USING: cgi cgi.private kernel tools.test ; USING: cgi cgi.private kernel linked-assocs tools.test ;
{ t } [ H{ } "" (query-string) = ] unit-test { LH{ } } [ "" (query-string) ] unit-test
{ t } [ H{ { "a" { "1" } } { "b" { "2" } } } { LH{ { "a" { "1" } } { "b" { "2" } } } }
"a=1&b=2" (query-string) = ] unit-test [ "a=1&b=2" (query-string) ] unit-test
{ t } [ H{ { "a" { "1" } } { "b" { "2" "3" } } } { LH{ { "a" { "1" } } { "b" { "2" "3" } } } }
"a=1&b=2&b=3" (query-string) = ] unit-test [ "a=1&b=2&b=3" (query-string) ] unit-test
{ t } [ "text/html" (content-type) { LH{ } "text/html" } [ "text/html" (content-type) ] unit-test
[ H{ } = ] [ "text/html" = ] bi* and ] unit-test
{ t } [ "text/html; charset=utf-8" (content-type) { LH{ { "charset" { "utf-8" } } } "text/html" }
[ H{ { "charset" { "utf-8" } } } = ] [ "text/html; charset=utf-8" (content-type) ] unit-test
[ "text/html" = ] bi* and ] unit-test

View File

@ -2,8 +2,8 @@
! See http://factorcode.org/license.txt for BSD license ! See http://factorcode.org/license.txt for BSD license
USING: arrays assocs combinators environment io kernel USING: arrays assocs combinators environment io kernel
math.parser regexp sequences splitting strings unicode.case linked-assocs math.parser regexp sequences splitting strings
urls.encoding ; unicode.case urls.encoding ;
IN: cgi IN: cgi
@ -20,7 +20,7 @@ IN: cgi
: (content-type) ( string -- params media/type ) : (content-type) ( string -- params media/type )
";" split unclip [ ";" split unclip [
[ H{ } clone ] [ first (query-string) ] if-empty [ LH{ } clone ] [ first (query-string) ] if-empty
] dip ; ] dip ;
: (multipart) ( -- assoc ) : (multipart) ( -- assoc )