pub fn patch<I: 'static, R, E: Render, F>(
pattern: impl Into<String>,
f: F,
) -> Route<I, R, E>Expand description
A route with a PATCH handler.
use web_net::{App, patch};
let app = App::builder()
.route(patch("/items/:id", |cx| cx.text(200, "changed")).csrf_exempt("example: no browser form"))
.build()?;
let r = serve_net::testing::respond(
&app,
b"PATCH /items/1 HTTP/1.1\r\nHost: localhost\r\nContent-Length: 0\r\n\r\n",
);
assert_eq!(r.text(), "changed");