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

Function bad_request

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

Source from the content-addressed store, hash-verified

115}
116
117pub fn bad_request<B>(res: dev::ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
118 let new_resp = NamedFile::open("static/errors/400.html")?
119 .customize()
120 .with_status(res.status())
121 .respond_to(res.request())
122 .map_into_boxed_body()
123 .map_into_right_body();
124
125 Ok(ErrorHandlerResponse::Response(res.into_response(new_resp)))
126}
127
128pub fn not_found<B>(res: dev::ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
129 let new_resp = NamedFile::open("static/errors/404.html")?

Callers

nothing calls this directly

Calls 1

ResponseClass · 0.85

Tested by

no test coverage detected