@@ -135,11 +135,11 @@ proc parseQuerySum(query: string): int =
135135 except ValueError :
136136 discard
137137
138- let pipelineHandler: HandlerAsync = proc (ctx: Context ) {.async .} =
138+ let pipelineHandler: HandlerAsync = proc (ctx: Context ) {.async , closure , gcsafe .} =
139139 ctx.response.setHeader (" Content-Type" , " text/plain" )
140140 resp " ok"
141141
142- let baseline11Handler: HandlerAsync = proc (ctx: Context ) {.async .} =
142+ let baseline11Handler: HandlerAsync = proc (ctx: Context ) {.async , closure , gcsafe .} =
143143 var sum = 0
144144 let query = ctx.request.query
145145 if query.len > 0 :
@@ -155,20 +155,20 @@ let baseline11Handler: HandlerAsync = proc(ctx: Context) {.async.} =
155155 ctx.response.setHeader (" Content-Type" , " text/plain" )
156156 resp $ sum
157157
158- let baseline2Handler: HandlerAsync = proc (ctx: Context ) {.async .} =
158+ let baseline2Handler: HandlerAsync = proc (ctx: Context ) {.async , closure , gcsafe .} =
159159 var sum = 0
160160 let query = ctx.request.query
161161 if query.len > 0 :
162162 sum = parseQuerySum (query)
163163 ctx.response.setHeader (" Content-Type" , " text/plain" )
164164 resp $ sum
165165
166- let jsonHandler: HandlerAsync = proc (ctx: Context ) {.async .} =
166+ let jsonHandler: HandlerAsync = proc (ctx: Context ) {.async , closure , gcsafe .} =
167167 let jsonStr = buildProcessedJson (dataset)
168168 ctx.response.setHeader (" Content-Type" , " application/json" )
169169 resp jsonStr
170170
171- let compressionHandler: HandlerAsync = proc (ctx: Context ) {.async .} =
171+ let compressionHandler: HandlerAsync = proc (ctx: Context ) {.async , closure , gcsafe .} =
172172 let headers = ctx.request.headers
173173 let acceptEncoding = if headers.hasKey (" Accept-Encoding" ): $ headers[" Accept-Encoding" ] else : " "
174174 ctx.response.setHeader (" Content-Type" , " application/json" )
@@ -183,12 +183,12 @@ let compressionHandler: HandlerAsync = proc(ctx: Context) {.async.} =
183183 else :
184184 resp jsonLargeResponse
185185
186- let uploadHandler: HandlerAsync = proc (ctx: Context ) {.async .} =
186+ let uploadHandler: HandlerAsync = proc (ctx: Context ) {.async , closure , gcsafe .} =
187187 let body = ctx.request.body
188188 ctx.response.setHeader (" Content-Type" , " text/plain" )
189189 resp $ body.len
190190
191- let dbHandler: HandlerAsync = proc (ctx: Context ) {.async .} =
191+ let dbHandler: HandlerAsync = proc (ctx: Context ) {.async , closure , gcsafe .} =
192192 if not dbAvailable:
193193 ctx.response.setHeader (" Content-Type" , " application/json" )
194194 resp " {\" items\" :[],\" count\" :0}"
@@ -219,7 +219,7 @@ let dbHandler: HandlerAsync = proc(ctx: Context) {.async.} =
219219 ctx.response.setHeader (" Content-Type" , " application/json" )
220220 resp $ (%* {" items" : items, " count" : items.len})
221221
222- let staticHandler: HandlerAsync = proc (ctx: Context ) {.async .} =
222+ let staticHandler: HandlerAsync = proc (ctx: Context ) {.async , closure , gcsafe .} =
223223 let filename = ctx.getPathParams (" filename" )
224224 if filename in staticFiles:
225225 let (data, ct) = staticFiles[filename]
@@ -242,7 +242,7 @@ let settings = newSettings(
242242
243243var app = newApp (settings = settings)
244244
245- let serverHeaderMiddleware: HandlerAsync = proc (ctx: Context ) {.async .} =
245+ let serverHeaderMiddleware: HandlerAsync = proc (ctx: Context ) {.async , closure , gcsafe .} =
246246 ctx.response.setHeader (" Server" , " prologue" )
247247 await switch (ctx)
248248
0 commit comments