diff --git a/servant-server/src/Servant/Server.hs b/servant-server/src/Servant/Server.hs index 58c34ea3..2a886683 100644 --- a/servant-server/src/Servant/Server.hs +++ b/servant-server/src/Servant/Server.hs @@ -33,7 +33,7 @@ module Servant.Server , embedNat , squashNat , generalizeNat - + , tweakResponse -- * Default error type , ServantErr(..) diff --git a/servant-server/src/Servant/Server/Internal/Router.hs b/servant-server/src/Servant/Server/Internal/Router.hs index 653af681..89f7c144 100644 --- a/servant-server/src/Servant/Server/Internal/Router.hs +++ b/servant-server/src/Servant/Server/Internal/Router.hs @@ -26,9 +26,7 @@ data Router' a = -- ^ left-biased choice between two routers deriving Functor --- | Apply a function to the result of a router in functor style. The result contains the failure --- cases so one use case is to turn failures into middleware response values with appropriate status --- codes, message bodies, etc. +-- | Apply a transformation to the response of a `Router`. tweakResponse :: (RouteResult Response -> RouteResult Response) -> Router -> Router tweakResponse f = fmap (\a -> \req cont -> a req (cont . f))