diff options
| author | Jan Sucan <jan@jansucan.com> | 2025-08-26 14:03:08 +0200 |
|---|---|---|
| committer | Jan Sucan <jan@jansucan.com> | 2025-08-26 14:03:08 +0200 |
| commit | 057aba264d31ba8f0ba904d2b5588bfa847b663f (patch) | |
| tree | 16becffcc1221f14f91f70b3ff3ddb6df87dbf78 /ch16/16_a_2.hs | |
| parent | ddec828c92aea78edb4da0d9f48097f5ecb31672 (diff) | |
16_a_2: Simplify the test requests
Diffstat (limited to 'ch16/16_a_2.hs')
| -rw-r--r-- | ch16/16_a_2.hs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ch16/16_a_2.hs b/ch16/16_a_2.hs index ede341e..5cd28c5 100644 --- a/ch16/16_a_2.hs +++ b/ch16/16_a_2.hs @@ -80,7 +80,7 @@ testReqInfinitelyLongLine = intercalate "\r\n" [ "Accept: text/html", "", "Hello World!" - ] ++ "\r\n" + ] testReq :: Int -> String testReq len = intercalate "\r\n" [ @@ -90,7 +90,7 @@ testReq len = intercalate "\r\n" [ "Accept: text/html", "", "Hello World!" - ] ++ "\r\n" + ] testReqContinuation :: Int -> String testReqContinuation len = intercalate "\r\n" [ @@ -102,7 +102,7 @@ testReqContinuation len = intercalate "\r\n" [ "Accept: text/html", "", "Hello World!" - ] ++ "\r\n" + ] -- For brevity, longs strings are shortened by '...' @@ -116,20 +116,20 @@ testReqContinuation len = intercalate "\r\n" [ -- Header line too long -- ghci> runParser p_request () "" (testReq 20) --- Right (HttpRequest {reqMethod = Post, reqURL = "index.html", reqHeaders = [("Host","book.realworldhaskell.org"),("User-Agent","uuuuuuuu"),("Accept","text/html")], reqBody = Just "Hello World!\r\n"}) +-- Right (HttpRequest {reqMethod = Post, reqURL = "index.html", reqHeaders = [("Host","book.realworldhaskell.org"),("User-Agent","uuuuuuuu"),("Accept","text/html")], reqBody = Just "Hello World!"}) -- ghci> runParser p_request () "" (testReq 4096) --- Right (HttpRequest {reqMethod = Post, reqURL = "index.html", reqHeaders = [("Host","book.realworldhaskell.org"),("User-Agent","uuu...uuuuuuu"),("Accept","text/html")], reqBody = Just "Hello World!\r\n"}) +-- Right (HttpRequest {reqMethod = Post, reqURL = "index.html", reqHeaders = [("Host","book.realworldhaskell.org"),("User-Agent","uuu...uuuuuuu"),("Accept","text/html")], reqBody = Just "Hello World!"}) -- ghci> runParser p_request () "" (testReq 4097) -- Left (line 3, column 4097): -- Header line too long -- ghci> runParser p_request () "" (testReqContinuation 20) --- Right (HttpRequest {reqMethod = Post, reqURL = "index.html", reqHeaders = [("Host","book.realworldhaskell.org"),("User-Agent","Mozilla/5.0 continuation of user agent uuuuuuuuuuuuuuuuuuu"),("Accept","text/html")], reqBody = Just "Hello World!\r\n"}) +-- Right (HttpRequest {reqMethod = Post, reqURL = "index.html", reqHeaders = [("Host","book.realworldhaskell.org"),("User-Agent","Mozilla/5.0 continuation of user agent uuuuuuuuuuuuuuuuuuu"),("Accept","text/html")], reqBody = Just "Hello World!"}) -- ghci> runParser p_request () "" (testReqContinuation 4096) --- Right (HttpRequest {reqMethod = Post, reqURL = "index.html", reqHeaders = [("Host","book.realworldhaskell.org"),("User-Agent","Mozilla/5.0 continuation of user agent uuuuuu...uuuuuu"),("Accept","text/html")], reqBody = Just "Hello World!\r\n"}) +-- Right (HttpRequest {reqMethod = Post, reqURL = "index.html", reqHeaders = [("Host","book.realworldhaskell.org"),("User-Agent","Mozilla/5.0 continuation of user agent uuuuuu...uuuuuu"),("Accept","text/html")], reqBody = Just "Hello World!"}) -- ghci> runParser p_request () "" (testReqContinuation 4097) -- Left (line 5, column 4097): |
