- Fixed cookie example from
Cookie
module documentation.getCookie
Function would return strict variant ofText
. Will convert it into lazy variant usingfromStrict
. - Exposed simple functions of
Cookie
module viaWeb.Scotty
&Web.Scotty.Trans
. - Add tests for URL encoding of query parameters and form parameters. Add
formData
action for decodingFromForm
instances (#321). - Add explicit redirect functions for all redirect status codes.
- Remove dependency on data-default class (#386). We have been exporting constants for default config values since 0.20, and this dependency was simply unnecessary.
- Remove re-export of
Network.Wai.Parse.ParseRequestBodyOptions
fromWeb.Scotty
andWeb.Scotty.Trans
. This is a type fromwai-extra
so exporting it is unnecessary.
- add
instance Parsable UTCTime
(#250) - add
filesOpts
(#369). Form parameters and files are only parsed from the request body if needed;filesOpts
introduces options to customize upload limits, a mechanism to back uploads with temporary files based on resourcet, as well as a continuation-based syntax to process such temporary files.
files
does not accept unbounded uploads anymore (see #183, #203), but likefilesOpts
it is backed by temporary files which are read back in memory and removed right away. The limits forfiles
are prescribed bydefaultParseBodyOptions
in wai-extra (#369).- Path parameters with value matching the parameter name prefixed by colon will properly populate
pathParams
with their literal value :/:param
will match/:param
and add aParam
with value("param", ":param")
(#301) - Accept text-2.1 (#364)
- Remove dependency upper bounds on
text
andbytestring
(#371) - When in 'verbose' mode any unhandled exceptions are printed to stderr as well (#374)
- some ActionT API functions have now a MonadIO or MonadUnliftIO constraint rather than Monad reflecting that there is where request reading takes place. E.g.
files
has now a MonadUnliftIO constraint on its base monad. (#369) - the File type has now a type parameter to reflect whether it carries file contents or just a filepath pointing to the temp file (#369).
- add
getResponseHeaders
,getResponseStatus
,getResponseContent
(#214) - add
captureParamMaybe
,formParamMaybe
,queryParamMaybe
(#322) - add
Web.Scotty.Trans.Strict
andWeb.Scotty.Trans.Lazy
(#334) - renamed
captureParam
,captureParamMaybe
, andcaptureParams
topathParam
,pathParamMaybe
,pathParams
respectively, keeping the old names as their synonyms (#344)
- deprecate
rescue
andliftAndCatchIO
(#332) - Deprecate
StatusError
,raise
andraiseStatus
(#351)
- Reverted the
MonadReader
instance ofActionT
so that it inherits the base monad (#342) - Scotty's API such as
queryParam
now throwsScottyException
rather thanStatusException
. Uncaught exceptions are handled byscottyExceptionHandler
, resembling the existing behaviour
File
type: the first component of the tuple is strict text now (used to be lazy prior to 0.21) (#370)
- Add doctest, refactor some inline examples into doctests (#353)
- document "
defaultHandler
only applies to endpoints defined after it" (#237)
- remove dependencies on 'base-compat' and 'base-compat-batteries' (#318)
- re-add MonadFail (ActionT m) instance (#325)
- re-add MonadError (ActionT m) instance, but the error type is now specialized to 'StatusError' (#325)
- raise lower bound on base ( > 4.14 ) to reflect support for GHC >= 8.10 (#325).
- Drop support for GHC < 8.10 and modernise the CI pipeline (#300).
- Adds a new
nested
handler that allows you to place an entire WAI Application under a Scotty route (#233). - Disambiguate request parameters (#204). Adjust the
Env
type to have three[Param]
fields instead of one, addcaptureParam
,formParam
,queryParam
and the associatedcaptureParams
,formParams
,queryParams
. Add deprecation notices toparam
andparams
. - Add
Scotty.Cookie
module (#293). - Change body parsing behaviour such that calls to
next
don't result in POST request bodies disappearing (#147). - (Internal) Remove unused type
RequestBodyState
(#313) - Rewrite
ActionT
using the "ReaderT pattern" (#310) https://www.fpcomplete.com/blog/readert-design-pattern/
Breaking:
- (#310) Introduce
unliftio
as a dependency, and base exception handling oncatch
. - (#310) Clarify the exception handling mechanism of ActionT, ScottyT.
rescue
changes signature to use properException
types rather than strings. RemoveScottyError
typeclass. - (#310) All ActionT methods (
text
,html
etc.) have now a MonadIO constraint on the base monad rather than Monad because the response is constructed in a TVar inside ActionEnv.rescue
has a MonadUnliftIO constraint. The Alternative instance of ActionT also is based on MonadUnliftIO because<|>
is implemented in terms ofcatch
.ScottyT
andActionT
do not have an exception type parameter anymore. - (#310) MonadError e (ActionT m) instance removed
- (#310) MonadFail (ActionT m) instance is missing by mistake.
- Fix CPP bug that prevented tests from building on Windows.
- Allow building with
transformers-0.6.*
andmtl-2.3.*
. Because theMonadTrans t
class gained aforall m. Monad m => Monad (t m)
superclass intransformers-0.6.0.0
, theMonadTrans
andMonadTransControl
instances forActionT e
now have aScottyError e
instance context to match theMonad
instance.
- Provide
MonadReader
andMonadState
instances forActionT
. - Add HTTP Status code as a field to
ActionError
, and add a sister function toraise
,raiseStatus
. This makes throwing a specific error code and exiting much cleaner, and avoids the strange defaulting to HTTP 500. This will make internal functions easier to implement with the right status codes 'thrown', such asjsonData
. - Correct http statuses returned by
jsonData
(#228). - Better error message when no data is provided to
jsonData
(#226). - Add
Semigroup
andMonoid
instances forActionT
andScottyT
- ScottyT: Use strict StateT instead of lazy
- Handle adjacent slashes in the request path as one (thanks @SkyWriter)
- Allow building the test suite with
hspec-wai-0.10
.
- Allow building with
base-4.13
(GHC 8.8).
- Drop the test suite's dependency on
hpc-coveralls
, which is unmaintained and does not build with GHC 8.4 or later.
- Migrate from
Network
toNetwork.Socket
to avoid deprecation warnings.
- Add
MonadThrow
andMonadCatch
instances forActionT
[abhinav] - Fix
matchAny
so that all methods are matched, not just standard ones [taphu]
- IO exceptions are no longer automatically turned into ScottyErrors by
liftIO
. UseliftAndCatchIO
to get that behavior. - New
finish
function. - Text values are now leniently decoded from ByteStrings.
- Added
MonadFail
instance forScottyT
- Lots of bound bumps on dependencies.
- Removed debug statement from routes
Parsable
instances forWord
,Word8
,Word16
,Word32
,Word64
[adamflott]Parsable
instances forInt8
,Int16
,Int32
,Int64
, andNatural
- Removed redundant
Monad
constraint onmiddleware
-
The monad parameters to
ScottyT
have been decoupled, causing the type of theScottyT
constructor to change. As a result,ScottyT
is no longer aMonadTrans
instance, and the type signatures ofscottyT
,scottyAppT
, andscottyOptsT
have been simplified. [ehamberg] -
socketDescription
no longer uses the deprecatedPortNum
constructor. Instead, it uses theShow
instance forPortNumber
. This changes the bytes from host to network order, so the output ofsocketDescription
could change. [ehamberg] -
Alternative
,MonadPlus
instances forActionT
-
scotty
now depends ontransformers-compat
. As a result,ActionT
now usesExceptT
, regardless of which version oftransformers
is used. As a result, several functions inWeb.Scotty.Trans
no longer require aScottyError
constraint, sinceExceptT
does not require anError
constraint (unlikeErrorT
). -
Added support for OPTIONS routes via the
options
function [alvare] -
Add
scottySocket
andscottySocketT
, exposing Warp Unix socket support [hakujin] -
Parsable
instance for lazyByteString
[tattsun] -
Added streaming uploads via the
bodyReader
function, which retrieves chunks of the request body. [edofic]ActionEnv
had agetBodyChunk
field added (inWeb.Scotty.Internal.Types
)RequestBodyState
andBodyPartiallyStreamed
added toWeb.Scotty.Internal.Types
-
jsonData
usesaeson
'seitherDecode
instead of justdecode
[k-bx]
- text/html/json only set Content-Type header when not already set
-
Add
charset=utf-8
toContent-Type
fortext
,html
andjson
-
Assume HTTP status 500 for
defaultHandler
-
Remove deprecated
source
method. -
No longer depend on conduit.
-
Bump
aeson
upper bound -
Fix
mtl
related deprecation warnings
-
Export internal types
-
Added
MonadBase
,MonadTransControl
andMonadBaseControl
instances forActionT
-
Upgrade to wai/wai-extra/warp 3.0
-
No longer depend on conduit-extra.
-
The
source
response method has been deprecated in favor of a newstream
response, matching changes in WAI 3.0. -
Removed the deprecated
reqHeader
function.
- Bump upper bound for case-insensitive, mtl and transformers.
- Bump lower bound on conduit, add conduit-extra to cabal build depends.
- Default warp settings now use
setFdCacheDuration 0
to work around a warp issue where file changes are not getting picked up.
-
Renamed
reqHeader
toheader
. Addedheaders
function to get all headers. -
Changed
MonadIO
instance forActionT
such that IO exceptions are lifted intoScottyError
s viastringError
. -
Make
Bool
parsing case-insensitive. Goal: support both Haskell's True/False and Javascript's true/false. Thanks to Ben Gamari for suggesting this. -
Bump
aeson
/text
upper bounds. -
Bump
wai
/wai-extra
/warp
bounds, including new lower bound forwarp
, which fixes a security issue related to Slowloris protection.
- Bump upper bound for
text
.
- Match changes in
wai-extra
.
-
The Scotty transformers (
ScottyT
andActionT
) are now parameterized over a custom exception type, allowing one to extend Scotty'sErrorT
layer with something richer thanText
errors. See theexceptions
example for use.ScottyM
andActionM
remain specialized toText
exceptions for simplicity. -
Both monads are now instances of
Functor
andApplicative
. -
There is a new
cookies
example. -
Internals brought up-to-date with WAI 2.0 and related packages.
-
The Scotty monads (
ScottyM
andActionM
) are now monad transformers, allowing Scotty applications to be embedded in arbitraryMonadIO
s. The old API continues to be exported fromWeb.Scotty
where:type ScottyM = ScottyT IO type ActionM = ActionT IO
The new transformers are found in
Web.Scotty.Trans
. See theglobalstate
example for use. Special thanks to Dan Frumin (co-dan) for much of the legwork here. -
Added support for HTTP PATCH method.
-
Removed lambda action syntax. This will return when we have a better story for typesafe routes.
-
reqHeader :: Text -> ActionM Text
==>reqHeader :: Text -> ActionM (Maybe Text)
-
New
raw
method to set body to a rawByteString
-
Parse error thrown by
jsonData
now includes the body it couldn't parse. -
header
split intosetHeader
andaddHeader
. The former replaces a response header (original behavior). The latter adds a header (useful for multipleSet-Cookie
s, for instance).