MCPcopy Create free account
hub / github.com/actix/examples / not_found

Function not_found

basics/todo/src/api.rs:128–137  ·  view source on GitHub ↗
(res: dev::ServiceResponse<B>)

Source from the content-addressed store, hash-verified

126}
127
128pub fn not_found<B>(res: dev::ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
129 let new_resp = NamedFile::open("static/errors/404.html")?
130 .customize()
131 .with_status(res.status())
132 .respond_to(res.request())
133 .map_into_boxed_body()
134 .map_into_right_body();
135
136 Ok(ErrorHandlerResponse::Response(res.into_response(new_resp)))
137}
138
139pub fn internal_server_error<B>(res: dev::ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
140 let new_resp = NamedFile::open("static/errors/500.html")?

Callers

nothing calls this directly

Calls 1

ResponseClass · 0.85

Tested by

no test coverage detected