method Router.dispatch
Route lookup and call, without the middleware.
Example:
use std.http { Router, Request, Reply }
fn main() io, net, time {
let router = Router.new().get("/a", (req: Request) => Reply.text("a"))
let req = Request{ method: "POST", target: "/a", path: "/a", rawQuery: "", version: "HTTP/1.1", headers: [], body: Utf8.encode(""), peer: "", params: [] }
let rep = router.dispatch(req)
print("{rep.status}")
}Вывод
405
pub(api) fn dispatch(req: Request) -> Reply net, io, timeПотокобезопасность. reads the router only; safe to call from many tasks at once.
С версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
req | Request |
Возвращает
Эффекты
net, io, time
Определено в: std/http/http.oxl:3707