returning custom responses #3545
-
Hello all, Current setup is running a service that receives the What would the the way to return a custom 404 response with some text if, for example, For example (mock): let host = req.header.s.get("host").unwrap_or(Header::Value::from_status("None"));
if host != "domain.tld" {
let custom_response = Response::builder().status(404).body("Not found").unwarp();
Ok(custom_response);
} Thank you for your help and guidance! |
Beta Was this translation helpful? Give feedback.
Answered by
seanmonstar
Jan 28, 2024
Replies: 1 comment 1 reply
-
You may find this guide to be helpful: https://hyper.rs/guides/1/server/echo/ |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
akrasic
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You may find this guide to be helpful: https://hyper.rs/guides/1/server/echo/