packages feed

servant-errors 0.1.5.0 → 0.1.6.0

raw patch · 3 files changed

+6/−2 lines, 3 files

Files

CHANGELOG.md view
@@ -37,3 +37,7 @@ ## 0.1.5.0  * add GHC 8.8 support++## 0.1.6.0++* Fix: use provided content-type
servant-errors.cabal view
@@ -1,6 +1,6 @@ cabal-version:       2.2 name:                servant-errors-version:             0.1.5.0+version:             0.1.6.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. 
src/Network/Wai/Middleware/Servant/Errors.hs view
@@ -164,7 +164,7 @@   -> IO Response newResponse status@(Status code statusMsg) response = do   body <- responseBody response-  let header = (hContentType,  M.renderHeader $ contentType (Proxy @JSON) )+  let header = (hContentType,  M.renderHeader $ contentType (Proxy @ctyp) )       content = ErrorMsg . cs $ if body == mempty then statusMsg else body       newContent = encodeError @ctyp @opts (StatusCode code) content   return $ responseLBS status [header] newContent