packages feed

scotty 0.11.3 → 0.11.4

raw patch · 5 files changed

+37/−25 lines, 5 filesdep ~warpPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: warp

API changes (from Hackage documentation)

Files

README.md view
@@ -16,10 +16,10 @@  Scotty is the cheap and cheerful way to write RESTful, declarative web applications. -* A page is as simple as defining the verb, url pattern, and Text content.+* A page is as simple as defining the verb, URL pattern, and Text content. * It is template-language agnostic. Anything that returns a Text value will do.-* Conforms to WAI Application interface.-* Uses very fast Warp webserver by default.+* Conforms to the [web application interface (WAI)](https://github.com/yesodweb/wai/).+* Uses the very fast Warp webserver by default.  See examples/basic.hs to see Scotty in action. (basic.hs needs the wai-extra package) @@ -33,12 +33,10 @@  ### More Information -Tutorials and related projects can be found in the Scotty wiki:--https://github.com/scotty-web/scotty/wiki+Tutorials and related projects can be found in the [Scotty wiki](https://github.com/scotty-web/scotty/wiki).  ### Development & Support  Open an issue on GitHub or join `#scotty` on Freenode. -Copyright (c) 2012-2017 Andrew Farmer+Copyright (c) 2012-2019 Andrew Farmer
Web/Scotty/Internal/Types.hs view
@@ -49,7 +49,7 @@                        }  instance Default Options where-    def = Options 1 defaultSettings +    def = Options 1 defaultSettings  ----- Transformer Aware Applications/Middleware ----- type Middleware m = Application m -> Application m@@ -141,7 +141,9 @@ instance (Monad m, ScottyError e) => Monad (ActionT e m) where     return = ActionT . return     ActionT m >>= k = ActionT (m >>= runAM . k)-    fail = ActionT . throwError . stringError+#if !(MIN_VERSION_base(4,13,0))+    fail = Fail.fail+#endif  instance (Monad m, ScottyError e) => Fail.MonadFail (ActionT e m) where     fail = ActionT . throwError . stringError
Web/Scotty/Route.hs view
@@ -23,6 +23,9 @@  import           Network.HTTP.Types import           Network.Wai (Request(..))+#if MIN_VERSION_wai(3,2,2)+import           Network.Wai.Internal (getRequestBodyChunk)+#endif import qualified Network.Wai.Parse as Parse hiding (parseRequestBody)  import qualified Text.Regex as Regex@@ -122,9 +125,9 @@ path = T.fromStrict . TS.cons '/' . TS.intercalate "/" . pathInfo  -- Stolen from wai-extra's Network.Wai.Parse, modified to accept body as list of Bytestrings.--- Reason: WAI's requestBody is an IO action that returns the body as chunks. Once read,--- they can't be read again. We read them into a lazy Bytestring, so Scotty user can get--- the raw body, even if they also want to call wai-extra's parsing routines.+-- Reason: WAI's getRequestBodyChunk is an IO action that returns the body as chunks.+-- Once read, they can't be read again. We read them into a lazy Bytestring, so Scotty+-- user can get the raw body, even if they also want to call wai-extra's parsing routines. parseRequestBody :: MonadIO m                  => [B.ByteString]                  -> Parse.BackEnd y@@ -144,8 +147,8 @@ mkEnv :: forall m. MonadIO m => Request -> [Param] -> m ActionEnv mkEnv req captures = do     bodyState <- liftIO $ newMVar BodyUntouched-    -    let rbody = requestBody req++    let rbody = getRequestBodyChunk req         takeAll :: ([B.ByteString] -> IO [B.ByteString]) -> IO [B.ByteString]         takeAll prefix = rbody >>= \b -> if B.null b then prefix [] else takeAll (prefix . (b:)) @@ -153,11 +156,11 @@         safeBodyReader =  do           state <- takeMVar bodyState           let direct = putMVar bodyState BodyCorrupted >> rbody-          case state of -            s@(BodyCached _ []) -> -              do putMVar bodyState s +          case state of+            s@(BodyCached _ []) ->+              do putMVar bodyState s                  return B.empty-            BodyCached b (chunk:rest) -> +            BodyCached b (chunk:rest) ->               do putMVar bodyState $ BodyCached b rest                  return chunk             BodyUntouched -> direct@@ -166,12 +169,12 @@         bs :: IO BL.ByteString         bs = do           state <- takeMVar bodyState-          case state of -            s@(BodyCached b _) -> +          case state of+            s@(BodyCached b _) ->               do putMVar bodyState s                  return b             BodyCorrupted -> throw BodyPartiallyStreamed-            BodyUntouched -> +            BodyUntouched ->               do chunks <- takeAll return                  let b = BL.fromChunks chunks                  putMVar bodyState $ BodyCached b chunks@@ -184,7 +187,7 @@                        parseRequestBody wholeBody Parse.lbsBackEnd req       else return ([], []) -    let +    let         convert (k, v) = (strictByteStringToLazyText k, strictByteStringToLazyText v)         parameters =  captures ++ map convert formparams ++ queryparams         queryparams = parseEncodedParams $ rawQueryString req@@ -245,3 +248,8 @@ -- | Build a route that requires the requested path match exactly, without captures. literal :: String -> RoutePattern literal = Literal . T.pack++#if !(MIN_VERSION_wai(3,2,2))+getRequestBodyChunk :: Request -> IO B.ByteString+getRequestBodyChunk = requestBody+#endif
changelog.md view
@@ -1,3 +1,6 @@+## 0.11.4 [2019.05.02]+* Allow building with `base-4.13` (GHC 8.8).+ ## 0.11.3 [2019.01.08] * Drop the test suite's dependency on `hpc-coveralls`, which is unmaintained   and does not build with GHC 8.4 or later.
scotty.cabal view
@@ -1,5 +1,5 @@ Name:                scotty-Version:             0.11.3+Version:             0.11.4 Synopsis:            Haskell web framework inspired by Ruby's Sinatra, using WAI and Warp Homepage:            https://github.com/scotty-web/scotty Bug-reports:         https://github.com/scotty-web/scotty/issues@@ -50,7 +50,8 @@                    , GHC == 8.0.2                    , GHC == 8.2.2                    , GHC == 8.4.4-                   , GHC == 8.6.3+                   , GHC == 8.6.5+                   , GHC == 8.8.1 Extra-source-files:     README.md     changelog.md@@ -86,7 +87,7 @@                        monad-control       >= 1.0.0.3  && < 1.1,                        mtl                 >= 2.1.2    && < 2.3,                        nats                >= 0.1      && < 2,-                       network             >= 2.6.0.2  && < 2.9,+                       network             >= 2.6.0.2  && < 3.2,                        regex-compat        >= 0.95.1   && < 0.96,                        text                >= 0.11.3.1 && < 1.3,                        transformers        >= 0.3.0.0  && < 0.6,