Use 'hyper' instead of 'http' where possible.

This commit is contained in:
Sergio Benitez 2021-08-08 14:05:56 -07:00
parent 6d2059f9eb
commit be3ceef4e3
2 changed files with 13 additions and 11 deletions

View File

@ -11,7 +11,7 @@
pub mod header {
macro_rules! import_http_headers {
($($name:ident),*) => ($(
pub use http::header::$name as $name;
pub use hyper::header::$name as $name;
)*)
}

View File

@ -3,6 +3,8 @@ use std::str::FromStr;
use self::Method::*;
use crate::hyper;
// TODO: Support non-standard methods, here and in codegen?
/// Representation of HTTP methods.
@ -52,17 +54,17 @@ pub enum Method {
impl Method {
/// WARNING: This is unstable! Do not use this method outside of Rocket!
#[doc(hidden)]
pub fn from_hyp(method: &http::method::Method) -> Option<Method> {
pub fn from_hyp(method: &hyper::Method) -> Option<Method> {
match *method {
http::method::Method::GET => Some(Get),
http::method::Method::PUT => Some(Put),
http::method::Method::POST => Some(Post),
http::method::Method::DELETE => Some(Delete),
http::method::Method::OPTIONS => Some(Options),
http::method::Method::HEAD => Some(Head),
http::method::Method::TRACE => Some(Trace),
http::method::Method::CONNECT => Some(Connect),
http::method::Method::PATCH => Some(Patch),
hyper::Method::GET => Some(Get),
hyper::Method::PUT => Some(Put),
hyper::Method::POST => Some(Post),
hyper::Method::DELETE => Some(Delete),
hyper::Method::OPTIONS => Some(Options),
hyper::Method::HEAD => Some(Head),
hyper::Method::TRACE => Some(Trace),
hyper::Method::CONNECT => Some(Connect),
hyper::Method::PATCH => Some(Patch),
_ => None,
}
}