packages feed

servant-errors 0.1.6.0 → 0.1.7.0

raw patch · 3 files changed

+11/−4 lines, 3 filesdep ~aesonPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: aeson

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -41,3 +41,8 @@ ## 0.1.6.0  * Fix: use provided content-type+++## 0.1.7.0++* Pass old headers to new response when contentType header be added in `newResponse`.
servant-errors.cabal view
@@ -1,6 +1,6 @@ cabal-version:       2.2 name:                servant-errors-version:             0.1.6.0+version:             0.1.7.0 synopsis:            Servant Errors wai-middlware description:         A Wai middleware that uniformly structures errors with in a servant application. The library assumes all HTTP responses with status code greater than 200 and without an HTTP content type are error responses. This assumption is derived from servant server error handling implementation. @@ -18,6 +18,7 @@ tested-with:         GHC == 8.4.4                    , GHC == 8.6.5                    , GHC == 8.8.3+                   , GHC == 8.8.4   source-repository head@@ -27,7 +28,7 @@ common common-options   build-depends:       base  >= 4.10.0.0 && < 4.15                      , base-compat >= 0.9.0-                     , aeson >= 1.3+                     , aeson >= 1.3 && < 1.6                      , text  >= 1.2                      , wai   >= 3.2 
src/Network/Wai/Middleware/Servant/Errors.hs view
@@ -164,10 +164,11 @@   -> IO Response newResponse status@(Status code statusMsg) response = do   body <- responseBody response-  let header = (hContentType,  M.renderHeader $ contentType (Proxy @ctyp) )+  let oldHeaders = responseHeaders response+  let newHeaders = (hContentType,  M.renderHeader $ contentType (Proxy @ctyp)) : oldHeaders       content = ErrorMsg . cs $ if body == mempty then statusMsg else body       newContent = encodeError @ctyp @opts (StatusCode code) content-  return $ responseLBS status [header] newContent+  return $ responseLBS status newHeaders newContent  -- | 'responseBody' extracts response body from the servant server response. responseBody :: Response -> IO B.ByteString