aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorCalvin Rose <calsrose@gmail.com>2021-10-23 10:54:02 -0500
committerCalvin Rose <calsrose@gmail.com>2021-10-23 10:54:02 -0500
commit8768b75f7477f40d646a10f491d4b17d1daca7ac (patch)
treec0e0c0d3d74ffcdbc8af90ac68a43477058da548 /test
parentAdd print-table to misc.janet (diff)
Improve middleware for http.
Diffstat (limited to 'test')
-rw-r--r--test/suite0012.janet7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/suite0012.janet b/test/suite0012.janet
index 11fb343..726c71f 100644
--- a/test/suite0012.janet
+++ b/test/suite0012.janet
@@ -62,4 +62,11 @@
(def res (http/request "POST" "http://127.0.0.1:9816" :body (string/repeat "a" 4194304)))
(test-http-item res nil nil 200 {"content-length" "4194304"}))
+# Test the query string grammar by itself.
+(assert (deep= @[@{"a" " "}] (peg/match http/query-string-grammar "a=%20")) "query string grammar 1")
+(assert (deep= @[@{"a" " " "b" true}] (peg/match http/query-string-grammar "a=%20&b")) "query string grammar 2")
+(assert (deep= @[@{"a" " " "b" true}] (peg/match http/query-string-grammar "a=%20;b")) "query string grammar 3")
+(assert (deep= @[@{"a" " " "b" "once upon a time"}] (peg/match http/query-string-grammar "a=%20&b=once+upon+a+time")) "query string grammar 4")
+(assert (deep= @[@{"a" " " "bedtime story" "once upon a time"}] (peg/match http/query-string-grammar "a=%20&bedtime+story=once+upon+a+time")) "query string grammar 4")
+
(end-suite)