Skip to main content

callable_accepts_request

Function callable_accepts_request 

Source
pub(crate) fn callable_accepts_request(
    py: Python<'_>,
    callable: &PyObject,
) -> PyResult<bool>
Expand description

Determine at runtime whether a Python callable accepts a request dict argument.

Uses inspect.signature to walk the parameter list. Returns true if any parameter is named request and its annotation contains "dict".

This lets the proxy call the validator with or without the request dict depending on what the supplied callback actually expects.