Skip to content

Commit 4901209

Browse files
authored
Avoid method item in ASGI ws scope (#420)
1 parent f172f0a commit 4901209

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/asgi/utils.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ pub(super) fn build_scope<'p>(
7070
scope.set_item(pyo3::intern!(py, "server"), server)?;
7171
scope.set_item(pyo3::intern!(py, "client"), client)?;
7272
scope.set_item(pyo3::intern!(py, "scheme"), scheme)?;
73-
scope.set_item(pyo3::intern!(py, "method"), req.method.as_str())?;
7473
scope.set_item(pyo3::intern!(py, "path"), path)?;
7574
scope.set_item(pyo3::intern!(py, "raw_path"), PyBytes::new_bound(py, path.as_bytes()))?;
7675
scope.set_item(
@@ -108,7 +107,9 @@ pub(super) fn build_scope_http<'p>(
108107
path: &'p str,
109108
query_string: &'p str,
110109
) -> PyResult<Bound<'p, PyDict>> {
111-
build_scope(py, req, "http", version, server, client, scheme, path, query_string)
110+
let scope = build_scope(py, req, "http", version, server, client, scheme, path, query_string)?;
111+
scope.set_item(pyo3::intern!(py, "method"), req.method.as_str())?;
112+
Ok(scope)
112113
}
113114

114115
#[inline]

0 commit comments

Comments
 (0)