yesod-test: failing tests for encoding errors

Related to issue #1616
This commit is contained in:
Christopher League 2019-08-13 10:04:10 -04:00
parent 37c0df8dc1
commit ac66323394

View File

@ -145,9 +145,11 @@ main = hspec $ do
request $ do request $ do
setMethod "POST" setMethod "POST"
setUrl $ LiteAppRoute ["post"] setUrl $ LiteAppRoute ["post"]
addPostParam "foo" "foobarbaz" -- If value uses special characters,
addPostParam "foo" "foo+bar%41&baz"
statusIs 200 statusIs 200
bodyEquals "foobarbaz" -- They pass through the server correctly.
bodyEquals "foo+bar%41&baz"
yit "labels" $ do yit "labels" $ do
get ("/form" :: Text) get ("/form" :: Text)
statusIs 200 statusIs 200
@ -155,11 +157,13 @@ main = hspec $ do
request $ do request $ do
setMethod "POST" setMethod "POST"
setUrl ("/form" :: Text) setUrl ("/form" :: Text)
byLabel "Some Label" "12345" byLabel "Some Label" "foo+bar%41&baz"
fileByLabel "Some File" "test/main.hs" "text/plain" fileByLabel "Some File" "test/main.hs" "text/plain"
addToken addToken
statusIs 200 statusIs 200
bodyEquals "12345" -- The '%', '&' get further encoded because "/form"
-- (unlike "/post") uses toHtml.
bodyEquals "foo+bar%2541&baz"
yit "labels WForm" $ do yit "labels WForm" $ do
get ("/wform" :: Text) get ("/wform" :: Text)
statusIs 200 statusIs 200