From ee934370bf8fdbb79d46fbd204a527667a2e4a57 Mon Sep 17 00:00:00 2001 From: ohmyc Date: Fri, 12 Jul 2024 13:51:50 +0300 Subject: [PATCH 1/2] now http method repr is string --- src/http/request/method.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/http/request/method.rs b/src/http/request/method.rs index e011973..a4be0ab 100644 --- a/src/http/request/method.rs +++ b/src/http/request/method.rs @@ -1,6 +1,5 @@ use pyo3::prelude::*; -#[pyclass] #[derive(Clone, Debug)] pub enum HttpMethod { Get, @@ -24,3 +23,16 @@ impl HttpMethod { } } } + +impl IntoPy> for HttpMethod { + fn into_py(self, py: Python<'_>) -> Py { + match self { + HttpMethod::Get => "GET", + HttpMethod::Put => "PUT", + HttpMethod::Head => "HEAD", + HttpMethod::Post => "POST", + HttpMethod::Patch => "PATCH", + HttpMethod::Delete => "DELETE", + }.into_py(py) + } +} From bb5649250aea82d9e5eb22b4c3cab337aad9a698 Mon Sep 17 00:00:00 2001 From: ohmyc Date: Fri, 12 Jul 2024 13:59:46 +0300 Subject: [PATCH 2/2] changed http visibility --- src/http/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/http/mod.rs b/src/http/mod.rs index b9e0125..b8be632 100644 --- a/src/http/mod.rs +++ b/src/http/mod.rs @@ -1,4 +1,5 @@ mod request; mod response; - +pub use request::*; +pub use response::*;