servant-errors 0.1.3.1 → 0.1.4.0
raw patch · 2 files changed
+3/−3 lines, 2 files
Files
servant-errors.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: servant-errors-version: 0.1.3.1+version: 0.1.4.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
@@ -1,6 +1,6 @@ {- | A Wai middleware that uniformly structures errors within a servant application.- The library assumes all HTTP responses with status codes greater than @200@ and+ The library assumes all HTTP responses with status codes between @4xx@ and @5xx@ while lacking an @HTTP content-type@ are error responses. This assumption is derived from servant server error handling implementation. @@ -144,7 +144,7 @@ let status = responseStatus response mcontentType = getContentTypeHeader response case (status, mcontentType) of- (Status code _, Nothing) | code > 200 ->+ (Status code _, Nothing) | code >= 400 && code < 600 -> newResponse @ctyp @opts status response >>= respond _ -> respond response where