From 66098427b4ae549ed84d281464a9a4ab880232d0 Mon Sep 17 00:00:00 2001 From: Marco Zocca Date: Mon, 1 Jan 2024 22:16:16 +0100 Subject: [PATCH] fix test --- Web/Scotty/Body.hs | 4 +++- test/Web/ScottySpec.hs | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Web/Scotty/Body.hs b/Web/Scotty/Body.hs index ba5a816..ab61a8b 100644 --- a/Web/Scotty/Body.hs +++ b/Web/Scotty/Body.hs @@ -97,8 +97,10 @@ parseRequestBodyExBS istate o bl rty = -- | Retrieve the entire body, using the cached chunks in the BodyInfo and reading any other -- chunks if they still exist. --- Mimic the previous behavior by throwing BodyPartiallyStreamed if the user has already +-- Mimic the previous behavior by throwing 'BodyPartiallyStreamed' if the user has already -- started reading the body by chunks. +-- +-- throw 'ScottyException' if request body too big getBodyAction :: BodyInfo -> RouteOptions -> IO (BL.ByteString) getBodyAction (BodyInfo readProgress chunkBufferVar getChunk) opts = modifyMVar readProgress $ \index -> diff --git a/test/Web/ScottySpec.hs b/test/Web/ScottySpec.hs index 9685cbd..a52b697 100644 --- a/test/Web/ScottySpec.hs +++ b/test/Web/ScottySpec.hs @@ -133,7 +133,12 @@ spec = do let large = TLE.encodeUtf8 . TL.pack . concat $ [show c | c <- ([1..4500]::[Integer])] smol = TLE.encodeUtf8 . TL.pack . concat $ [show c | c <- ([1..50]::[Integer])] - withApp (Scotty.setMaxRequestBodySize 1 >> Scotty.post "/upload" (do status status200)) $ do + withApp (do + Scotty.setMaxRequestBodySize 1 + Scotty.post "/upload" $ do + _ <- files + status status200 + ) $ do context "application/x-www-form-urlencoded" $ do it "should return 200 OK if the request body size is below 1 KB" $ do request "POST" "/upload" [("Content-Type","application/x-www-form-urlencoded")]