diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-07-08 10:34:12 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2016-07-08 10:34:12 +0200 |
commit | b47d9b7b917202ab3b7f1632f8d9462c5f76e869 (patch) | |
tree | 9b4c44ec1846c2ce276948ba37631cbef7e0ba26 /tests/async | |
parent | caa7f42e8e75e273ab3f52ada30aed4e06a817d9 (diff) | |
download | Nim-b47d9b7b917202ab3b7f1632f8d9462c5f76e869.tar.gz |
fixes #4371
Diffstat (limited to 'tests/async')
-rw-r--r-- | tests/async/treturn_await.nim | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/async/treturn_await.nim b/tests/async/treturn_await.nim new file mode 100644 index 000000000..8d266d665 --- /dev/null +++ b/tests/async/treturn_await.nim @@ -0,0 +1,23 @@ + +# bug #4371 + +import strutils, asyncdispatch, asynchttpserver + +type + List[A] = ref object + value: A + next: List[A] + StrPair* = tuple[k, v: string] + Context* = object + position*: int + accept*: bool + headers*: List[StrPair] + Handler* = proc(req: ref Request, ctx: Context): Future[Context] + +proc logging*(handler: Handler): auto = + proc h(req: ref Request, ctx: Context): Future[Context] {.async.} = + let ret = handler(req, ctx) + debugEcho "$3 $1 $2".format(req.reqMethod, req.url.path, req.hostname) + return await ret + + return h |