diff --git a/src/executors/mod.rs b/src/executors/mod.rs index 8320e9f4f..50da0f896 100644 --- a/src/executors/mod.rs +++ b/src/executors/mod.rs @@ -28,6 +28,7 @@ where let kwargs = function.kwargs.as_ref(py); let function_args = function_args.to_object(py); + debug!("Function args: {:?}", function_args); match function.number_of_params { 0 => handler.call0(), @@ -84,6 +85,7 @@ where } else { Python::with_gil(|py| -> Result { let output = get_function_output(function, py, input)?; + debug!("Middleware output: {:?}", output); match output.extract::() { Ok(o) => Ok(MiddlewareReturn::Response(o)), Err(_) => Ok(MiddlewareReturn::Request(output.extract::()?)), diff --git a/src/types/mod.rs b/src/types/mod.rs index 0af7a6b00..062e63a51 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -1,3 +1,4 @@ +use log::debug; use pyo3::{ exceptions::PyValueError, prelude::*, @@ -78,9 +79,8 @@ pub fn get_body_from_pyobject(body: &PyAny) -> PyResult> { } else if let Ok(b) = body.downcast::() { Ok(b.as_bytes().to_vec()) } else { - Err(PyValueError::new_err( - "Could not convert specified body to bytes", - )) + debug!("Could not convert specified body to bytes"); + Ok(vec![]) } } @@ -90,9 +90,8 @@ pub fn get_description_from_pyobject(description: &PyAny) -> PyResult> { } else if let Ok(b) = description.downcast::() { Ok(b.as_bytes().to_vec()) } else { - Err(PyValueError::new_err( - "Could not convert specified description to bytes", - )) + debug!("Could not convert specified response description to bytes"); + Ok(vec![]) } }