om-http 0.4.0.0 → 0.4.1.0
raw patch · 2 files changed
+43/−25 lines, 2 filesdep +aesondep ~asyncdep ~basedep ~bytestringPVP ok
version bump matches the API change (PVP)
Dependencies added: aeson
Dependency ranges changed: async, base, bytestring, case-insensitive, directory, filepath, http-types, mime-types, monad-logger-aeson, network, om-show, safe-exceptions, servant, template-haskell, text, time, unix, uuid, wai, warp
API changes (from Hackage documentation)
Files
- om-http.cabal +23/−22
- src/OM/HTTP.hs +20/−3
om-http.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: om-http-version: 0.4.0.0+version: 0.4.1.0 synopsis: Http utilities. description: Random HTTP utilities. homepage: https://github.com/owensmurray/om-http@@ -8,7 +8,7 @@ license-file: LICENSE author: Rick Owens maintainer: rick@owensmurray.com-copyright: 2022 Owens Murray+copyright: 2025 Owens Murray category: Web build-type: Simple extra-source-files:@@ -17,27 +17,28 @@ common dependencies build-depends:- , async >= 2.2.4 && < 2.3- , base >= 4.15.1.0 && < 4.21+ , aeson >= 2.2.2.0 && < 2.3+ , async >= 2.2.5 && < 2.3+ , base >= 4.20.0.0 && < 4.21 , base64 >= 1.0 && < 1.1- , bytestring >= 0.11.1.0 && < 0.13- , case-insensitive >= 1.2.1.0 && < 1.3- , directory >= 1.3.6.2 && < 1.4- , filepath >= 1.4.2.1 && < 1.6- , http-types >= 0.12.3 && < 0.13- , mime-types >= 0.1.1.0 && < 0.2- , monad-logger-aeson >= 0.4.1.3 && < 0.5- , network >= 3.1.2.7 && < 3.3- , om-show >= 0.1.2.8 && < 0.2- , safe-exceptions >= 0.1.7.3 && < 0.2- , servant >= 0.19 && < 0.21- , template-haskell >= 2.17.0.0 && < 2.23- , text >= 2.0 && < 2.2- , time >= 1.9.3 && < 1.13- , unix >= 2.7.2.2 && < 2.9- , uuid >= 1.3.15 && < 1.4- , wai >= 3.2.3 && < 3.3- , warp >= 3.3.23 && < 3.5+ , bytestring >= 0.11.5.0 && < 0.13+ , case-insensitive >= 1.2.0.11 && < 1.3+ , directory >= 1.3.7.1 && < 1.4+ , filepath >= 1.4.101.0 && < 1.6+ , http-types >= 0.12.4 && < 0.13+ , mime-types >= 0.1.0.0 && < 0.2+ , monad-logger-aeson >= 0.4.1.2 && < 0.5+ , network >= 3.1.2.9 && < 3.3+ , om-show >= 0.1.2.10 && < 0.2+ , safe-exceptions >= 0.1.7.4 && < 0.2+ , servant >= 0.20.1 && < 0.21+ , template-haskell >= 2.22.0.0 && < 2.23+ , text >= 2.1.1 && < 2.2+ , time >= 1.9.2 && < 1.13+ , unix >= 2.7.3 && < 2.9+ , uuid >= 1.3.16 && < 1.4+ , wai >= 3.2.0 && < 3.3+ , warp >= 3.3.21 && < 3.5 common warnings ghc-options:
src/OM/HTTP.hs view
@@ -22,7 +22,8 @@ import Control.Concurrent (threadDelay) import Control.Concurrent.Async (concurrently_)-import Control.Exception (try)+import Control.Exception (someExceptionContext, try)+import Control.Exception.Context (displayExceptionContext) import Control.Exception.Safe (SomeException, bracket, finally, throwM, tryAny) import Control.Monad (join, void) import Control.Monad.IO.Class (MonadIO(liftIO))@@ -30,6 +31,7 @@ ( LoggingT(runLoggingT), Message((:#)), (.=), Loc, LogLevel, LogSource, LogStr , MonadLoggerIO, logError, logInfo )+import Data.Aeson (object) import Data.Base64.Types (extractBase64) import Data.ByteString (ByteString) import Data.ByteString.Base64 (encodeBase64)@@ -60,7 +62,7 @@ , requestHeaders, requestMethod ) , Application, Middleware, Response, ResponseReceived, mapResponseHeaders- , responseLBS, responseRaw, responseStatus+ , responseHeaders, responseLBS, responseRaw, responseStatus ) import Network.Wai.Handler.Warp (run) import OM.Show (showt)@@ -209,6 +211,7 @@ logError $ "`app` failed with exception. The exception will be re-thrown." :# [ "exception" .= show (err :: SomeException)+ , "context" .= displayExceptionContext (someExceptionContext err) ] throwM err Right val -> pure val@@ -225,7 +228,20 @@ Left err -> do logError $ "`respond` failed with exception. The exception will be re-thrown." :#- ["exception" .= show (err :: SomeException)]+ [ "exception" .= show (err :: SomeException)+ , "context" .= displayExceptionContext (someExceptionContext err)+ , "response" .= object+ [ "status" .= showStatus (responseStatus response)+ , "headers" .=+ fmap+ (\(name, val) ->+ decodeUtf8Safe (CI.original name)+ <> ": "+ <> decodeUtf8Safe val+ )+ (responseHeaders response)+ ]+ ] throwM err Right ack -> pure ack now <- ack `seq` liftIO getCurrentTime@@ -299,6 +315,7 @@ uuid <- getUUID logError $ "Internal Server Error" :# [ "exception" .= show err+ , "context" .= displayExceptionContext (someExceptionContext err) , "id" .= uuid ] return uuid