-
-
Notifications
You must be signed in to change notification settings - Fork 339
Closed as not planned
Description
Sometimes I want to use status code as an error type like following:
fn method_guard(req: &Request<()>) -> Result<(), Box<dyn std::error::Error>> {
if req.method() != Method::GET {
return Err(Box::new(StatusCode::METHOD_NOT_ALLOWED));
}
Ok(())
}
Using a new type could resolve the issue but it's an inconvenience for library code where ideally I want to re-export http
types as much as possible.
Metadata
Metadata
Assignees
Labels
No labels