Skip to content

Commit 3d56d73

Browse files
committed
Allow building with text-2.0
For the most part, this is simply a matter of raising the upper version bounds in the `.cabal` file. The max-size request test case in the test suite needed to be adjusted, as it needs to pick a sufficiently large request such that it takes multiple chunks to store it as a lazy Text value. With `text-2.0` or later, the amount of ASCII characters that a single chunk can store is much larger due to using UTF-8 encoding internally, so we must generate a larger request to compensate.
1 parent c31a8e2 commit 3d56d73

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

scotty.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Library
8585
mtl >= 2.1.2 && < 2.4,
8686
network >= 2.6.0.2 && < 3.2,
8787
regex-compat >= 0.95.1 && < 0.96,
88-
text >= 0.11.3.1 && < 1.3,
88+
text >= 0.11.3.1 && < 2.1,
8989
transformers >= 0.3.0.0 && < 0.7,
9090
transformers-base >= 0.4.1 && < 0.5,
9191
transformers-compat >= 0.4 && < 0.8,

test/Web/ScottySpec.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ spec = do
122122
withApp (Scotty.setMaxRequestBodySize 1 >> Scotty.matchAny "/upload" (do status status200)) $ do
123123
it "upload endpoint for max-size requests, status 413 if request is too big, 200 otherwise" $ do
124124
request "POST" "/upload" [("Content-Type","multipart/form-data; boundary=--33")]
125-
(TLE.encodeUtf8 . TL.pack . concat $ [show c | c <- ([1..1500]::[Integer])]) `shouldRespondWith` 413
125+
(TLE.encodeUtf8 . TL.pack . concat $ [show c | c <- ([1..4500]::[Integer])]) `shouldRespondWith` 413
126126
request "POST" "/upload" [("Content-Type","multipart/form-data; boundary=--33")]
127127
(TLE.encodeUtf8 . TL.pack . concat $ [show c | c <- ([1..50]::[Integer])]) `shouldRespondWith` 200
128128

0 commit comments

Comments
 (0)