OxL Справочник OxL
РусскийEnglish

type Next

The rest of the chain as seen by a middleware: the next middleware and finally the router's own dispatch. Same name and call shape (next(x)) as std.rpc.Next of the rpc middleware (§10.2), D-3995.

Example:

oxl✓ проверяется в CI
use std.http { Next, Request, Reply, Middleware }

// a middleware calls `next(req)` to continue the chain
fn tag(req: Request, next: Next) -> Reply net, io, time {
  next(req).withHeader("X-Tagged", "yes")
}

fn main() io {
  let mw: Middleware = tag
  print("ok")
}
Вывод
ok
pub(api) type Next = fn(Request) -> Reply net, io, time

С версии. 1.0.0-beta

Определено в: std/http/http.oxl:3038

См. также