webgear-server 1.4.0 → 1.5.0
raw patch · 3 files changed
+23/−14 lines, 3 filesdep ~QuickCheckdep ~http-api-datadep ~jose
Dependency ranges changed: QuickCheck, http-api-data, jose, quickcheck-instances, webgear-core
Files
- CHANGELOG.md +7/−1
- src/WebGear/Server/MIMETypes.hs +14/−11
- webgear-server.cabal +2/−2
CHANGELOG.md view
@@ -2,6 +2,11 @@ ## [Unreleased] +## [1.5.0] - 2025-07-23++### Changed+- Make FormData backend monadic (breaking change) (#59)+ ## [1.4.0] - 2025-05-19 ### Added@@ -100,7 +105,8 @@ - Automated tests - Documentation -[Unreleased]: https://github.com/haskell-webgear/webgear/compare/v1.4.0...HEAD+[Unreleased]: https://github.com/haskell-webgear/webgear/compare/v1.5.0...HEAD+[1.5.0]: https://github.com/haskell-webgear/webgear/releases/tag/v1.5.0 [1.4.0]: https://github.com/haskell-webgear/webgear/releases/tag/v1.4.0 [1.3.1]: https://github.com/haskell-webgear/webgear/releases/tag/v1.3.1 [1.3.0]: https://github.com/haskell-webgear/webgear/releases/tag/v1.3.0
src/WebGear/Server/MIMETypes.hs view
@@ -46,19 +46,21 @@ as specified by a MIME type. -} class (MIMEType mt) => BodyUnrender m mt a where- -- | Parse a request body. Return a 'Left' value with error messages- -- in case of failure.+ {- | Parse a request body. Return a 'Left' value with error messages+ in case of failure.+ -} bodyUnrender :: mt -> Request -> m (Either Text a) {- | Instances of this class serializes a value to a response body as specified by a MIME type. -} class (MIMEType mt) => BodyRender m mt a where- -- | Render a value in the format specified by the media type.- --- -- Returns the response body and the media type to be used in the- -- "Content-Type" header. This could be a variant of the original- -- media type with additional parameters.+ {- | Render a value in the format specified by the media type.++ Returns the response body and the media type to be used in the+ "Content-Type" header. This could be a variant of the original+ media type with additional parameters.+ -} bodyRender :: mt -> Response -> a -> m (HTTP.MediaType, ResponseBody) --------------------------------------------------------------------------------@@ -127,11 +129,12 @@ st <- liftResourceT getInternalState pure $ tempFileBackEnd st -instance (MonadIO m) => BodyUnrender m (FormData a) (FormDataResult a) where- bodyUnrender :: FormData a -> Request -> m (Either Text (FormDataResult a))+instance (MonadIO m) => BodyUnrender m (FormData m a) (FormDataResult a) where+ bodyUnrender :: FormData m a -> Request -> m (Either Text (FormDataResult a)) bodyUnrender FormData{parseOptions, backendOptions} request = do- (formDataParams, formDataFiles) <-- liftIO $ parseRequestBodyEx parseOptions backendOptions $ toWaiRequest request+ (formDataParams, formDataFiles) <- do+ be <- backendOptions+ liftIO $ parseRequestBodyEx parseOptions be $ toWaiRequest request pure $ Right FormDataResult{formDataParams, formDataFiles} --------------------------------------------------------------------------------
webgear-server.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: webgear-server-version: 1.4.0+version: 1.5.0 synopsis: Composable, type-safe library to build HTTP API servers description: WebGear is a library to for building composable, type-safe HTTP API servers.@@ -59,7 +59,7 @@ , http-types ==0.12.* , text >=2.0 && <2.2 , wai ==3.2.*- , webgear-core ^>=1.4.0+ , webgear-core ^>=1.5.0 ghc-options: -Wall -Wcompat -Widentities