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
10
10
( -- * Run a wai application from an API
11
11
serve
12
12
, serveWithContext
13
+ , fullyEvalResponse
14
+ , noEvalResponse
13
15
14
16
, -- * Construct a wai Application from an API
15
17
toApplication
@@ -124,16 +126,23 @@ import Servant.Server.Internal
124
126
--
125
127
126
128
serve :: (HasServer api '[Bool ]) => Proxy api -> Server api -> Application
127
- serve p = serveWithContext p ( False :. EmptyContext )
129
+ serve p = serveWithContext p noEvalResponse
128
130
129
131
serveWithContext :: (HasServer api context , HasContextEntry context Bool )
130
132
=> Proxy api -> Context context -> Server api -> Application
131
133
serveWithContext p context server =
132
134
toApplication
133
- (getContextEntry context :: Bool )
135
+ (( getContextEntry context :: Bool ) || False )
134
136
-- ^ determins if we should fully evaluate response
137
+ -- defaults to False
135
138
(runRouter (route p context (emptyDelayed (Route server))))
136
139
140
+ fullyEvalResponse :: Context '[Bool ]
141
+ fullyEvalResponse = True :. EmptyContext
142
+
143
+ noEvalResponse :: Context '[Bool ]
144
+ noEvalResponse = False :. EmptyContext
145
+
137
146
-- | Hoist server implementation.
138
147
--
139
148
-- 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