aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorJosef Pospíšil <josef.pospisil@laststar.eu>2021-10-14 12:54:55 +0200
committerJosef Pospíšil <josef.pospisil@laststar.eu>2021-10-14 12:54:55 +0200
commit9ce8536a866b627b09a371d65c5d23ddbc063d40 (patch)
tree0264b0d33e164d0f3f60cd990e01cd21f84903b4 /test
parentFix read body and add auto body read in request (diff)
Add actual body size assert
Diffstat (limited to 'test')
-rw-r--r--test/suite0012.janet21
1 files changed, 12 insertions, 9 deletions
diff --git a/test/suite0012.janet b/test/suite0012.janet
index 4c13755..bdd3032 100644
--- a/test/suite0012.janet
+++ b/test/suite0012.janet
@@ -51,18 +51,21 @@
{:status 200 :body (string (http/read-body req))})
(with [server (http/server body-server "127.0.0.1" 9816)]
- (test-http-item (http/request "POST" "http://127.0.0.1:9816"
- :body "Strong and healthy")
- nil nil 200 {"content-length" "18"}))
+ (def res (http/request "POST" "http://127.0.0.1:9816" :body "Strong and healthy"))
+ (test-http-item res nil nil 200 {"content-length" "18"})
+ (assert (= (length (res :body)) 18)
+ "actual body length"))
(with [server (http/server body-server "127.0.0.1" 9816)]
- (test-http-item (http/request "POST" "http://127.0.0.1:9816"
- :body (string/repeat "a" 2097152))
- nil nil 200 {"content-length" "2097152"}))
+ (def res (http/request "POST" "http://127.0.0.1:9816" :body (string/repeat "a" 2097152)))
+ (test-http-item res nil nil 200 {"content-length" "2097152"})
+ (assert (= (length (res :body)) 18)
+ "actual body length"))
(with [server (http/server body-server "127.0.0.1" 9816)]
- (test-http-item (http/request "POST" "http://127.0.0.1:9816"
- :body (string/repeat "a" 4194304))
- nil nil 200 {"content-length" "4194304"}))
+ (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"})
+ (assert (= (length (res :body)) 18)
+ "actual body length"))
(end-suite)