From ac66323394025f577328c6eb86eeb5396d9fd086 Mon Sep 17 00:00:00 2001 From: Christopher League Date: Tue, 13 Aug 2019 10:04:10 -0400 Subject: [PATCH] yesod-test: failing tests for encoding errors Related to issue #1616 --- yesod-test/test/main.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/yesod-test/test/main.hs b/yesod-test/test/main.hs index c488d7ee..5bd45a17 100644 --- a/yesod-test/test/main.hs +++ b/yesod-test/test/main.hs @@ -145,9 +145,11 @@ main = hspec $ do request $ do setMethod "POST" setUrl $ LiteAppRoute ["post"] - addPostParam "foo" "foobarbaz" + -- If value uses special characters, + addPostParam "foo" "foo+bar%41&baz" statusIs 200 - bodyEquals "foobarbaz" + -- They pass through the server correctly. + bodyEquals "foo+bar%41&baz" yit "labels" $ do get ("/form" :: Text) statusIs 200 @@ -155,11 +157,13 @@ main = hspec $ do request $ do setMethod "POST" setUrl ("/form" :: Text) - byLabel "Some Label" "12345" + byLabel "Some Label" "foo+bar%41&baz" fileByLabel "Some File" "test/main.hs" "text/plain" addToken statusIs 200 - bodyEquals "12345" + -- The '%', '&' get further encoded because "/form" + -- (unlike "/post") uses toHtml. + bodyEquals "foo+bar%2541&baz" yit "labels WForm" $ do get ("/wform" :: Text) statusIs 200