diff --git a/src/response.rs b/src/response.rs index 044b9f22..c375e302 100644 --- a/src/response.rs +++ b/src/response.rs @@ -422,9 +422,15 @@ impl Response { self.res.ext().get() } - /// Set a response scoped extension value. - pub fn insert_ext(&mut self, val: T) { - self.res.ext_mut().insert(val); + /// Get a mutable reference to value stored in response extensions. + #[must_use] + pub fn ext_mut(&mut self) -> Option<&mut T> { + self.res.ext_mut().get_mut() + } + + /// Set a response extension value. + pub fn set_ext(&mut self, val: T) -> Option { + self.res.ext_mut().insert(val) } /// Create a `tide::Response` from a type that can be converted into an