File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
servant-server/src/Servant Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ module Servant.Server
1010 ( -- * Run a wai application from an API
1111 serve
1212 , serveWithContext
13+ , fullyEvalResponse
14+ , noEvalResponse
1315
1416 , -- * Construct a wai Application from an API
1517 toApplication
@@ -124,16 +126,23 @@ import Servant.Server.Internal
124126--
125127
126128serve :: (HasServer api '[Bool ]) => Proxy api -> Server api -> Application
127- serve p = serveWithContext p ( False :. EmptyContext )
129+ serve p = serveWithContext p noEvalResponse
128130
129131serveWithContext :: (HasServer api context , HasContextEntry context Bool )
130132 => Proxy api -> Context context -> Server api -> Application
131133serveWithContext p context server =
132134 toApplication
133- (getContextEntry context :: Bool )
135+ (( getContextEntry context :: Bool ) || False )
134136 -- ^ determins if we should fully evaluate response
137+ -- defaults to False
135138 (runRouter (route p context (emptyDelayed (Route server))))
136139
140+ fullyEvalResponse :: Context '[Bool ]
141+ fullyEvalResponse = True :. EmptyContext
142+
143+ noEvalResponse :: Context '[Bool ]
144+ noEvalResponse = False :. EmptyContext
145+
137146-- | Hoist server implementation.
138147--
139148-- Sometimes our cherished `Handler` monad isn't quite the type you'd like for
You can’t perform that action at this time.
0 commit comments