@@ -199,7 +199,7 @@ function http_handler(apis::Channel{APIInvoker{T,F}}, preproc::Function, req::HT
199199 catch e
200200 res = HTTP. Response (500 )
201201 Base. showerror (stderr , e, catch_backtrace ())
202- err (" Exception in handler: " , e)
202+ @error (" Exception in handler: " , e)
203203 end
204204 @debug (" response" , res)
205205 return res
@@ -210,7 +210,7 @@ default_preproc(req::HTTP.Request) = nothing
210210# add a multipart form handler, provide default
211211struct HttpRpcServer{T,F}
212212 api:: Channel{APIInvoker{T,F}}
213- handler:: HTTP.HandlerFunction
213+ handler:: HTTP.RequestHandlerFunction
214214end
215215
216216HttpRpcServer (api:: APIInvoker{T,F} , preproc:: Function = default_preproc) where {T,F} = HttpRpcServer ([api], preproc)
@@ -220,13 +220,15 @@ function HttpRpcServer(apis::Vector{APIInvoker{T,F}}, preproc::Function=default_
220220 put! (api, member)
221221 end
222222
223- HttpRpcServer {T,F} (api, HTTP. HandlerFunction (req-> http_handler (api, preproc, req)))
223+ handler_fn = (req)-> JuliaWebAPI. http_handler (api, preproc, req)
224+ handler = HTTP. RequestHandlerFunction (handler_fn)
225+ HttpRpcServer {T,F} (api, handler)
224226end
225227
226228run_http (api:: Union{Vector{APIInvoker{T,F}},APIInvoker{T,F}} , port:: Int , preproc:: Function = default_preproc; kwargs... ) where {T,F} = run_http (HttpRpcServer (api, preproc), port; kwargs... )
227229function run_http (httprpc:: HttpRpcServer{T,F} , port:: Int ; kwargs... ) where {T,F}
228- @debug (" running HTTP RPC server..." )
229- HTTP. listen (ip " 0.0.0.0" , port; kwargs... ) do req:: HTTP.Request
230+ @info (" running HTTP RPC server..." )
231+ HTTP. listen (ip " 0.0.0.0" , port; kwargs... ) do req
230232 HTTP. handle (httprpc. handler, req)
231233 end
232234end
0 commit comments