mirror of
https://github.com/status-im/nim-json-rpc.git
synced 2025-02-20 16:28:29 +00:00
HttpAuthHook use async raises
This commit is contained in:
parent
addfc322f5
commit
c5c40af304
@ -32,7 +32,7 @@ type
|
||||
# - HttpResponse: could not authenticate, stop execution
|
||||
# and return the response
|
||||
HttpAuthHook* = proc(request: HttpRequestRef): Future[HttpResponseRef]
|
||||
{.gcsafe, raises: [Defect, CatchableError].}
|
||||
{.gcsafe, async: (raises: [CatchableError]).}
|
||||
|
||||
# This inheritance arrangement is useful for
|
||||
# e.g. combo HTTP server
|
||||
|
@ -25,7 +25,8 @@ proc authHeaders(): seq[(string, string)] =
|
||||
@[("Auth-Token", "Good Token")]
|
||||
|
||||
suite "HTTP server hook test":
|
||||
proc mockAuth(req: HttpRequestRef): Future[HttpResponseRef] {.async.} =
|
||||
proc mockAuth(req: HttpRequestRef): Future[HttpResponseRef] {.
|
||||
gcsafe, async: (raises: [CatchableError]).} =
|
||||
if req.headers.getString("Auth-Token") == "Good Token":
|
||||
return HttpResponseRef(nil)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user