Skip to content

Commit fd555a6

Browse files
committed
Add Response::from_res
1 parent f575a12 commit fd555a6

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/response.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,23 @@ impl Response {
247247
self.res.local_mut().insert(val);
248248
self
249249
}
250+
251+
/// Create a `tide::Response` from a type that can be converted into an
252+
/// `http_types::Response`.
253+
pub fn from_res<T>(value: T) -> Self
254+
where
255+
T: Into<http_types::Response>,
256+
{
257+
let res: http_types::Response = value.into();
258+
Self {
259+
res,
260+
cookie_events: vec![],
261+
}
262+
}
250263
}
251264

252265
impl Into<http::Response> for Response {
253-
fn into(self) -> http::Response {
266+
fn into(self) -> http_types::Response {
254267
self.res
255268
}
256269
}

0 commit comments

Comments
 (0)