Skip to content

Commit 1a6ad9d

Browse files
committed
hyperapp: allow accessing IncomingHttpRequest
1 parent 91cc5ae commit 1a6ad9d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/hyperapp.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@ pub fn get_server() -> Option<&'static mut HttpServer> {
7272
APP_HELPERS.with(|ctx| ctx.borrow().current_server.map(|ptr| unsafe { &mut *ptr }))
7373
}
7474

75+
pub fn get_http_request() -> Option<IncomingHttpRequest> {
76+
APP_HELPERS.with(|helpers| {
77+
helpers
78+
.borrow()
79+
.current_http_context
80+
.as_ref()
81+
.map(|ctx| ctx.request.clone())
82+
})
83+
}
84+
7585
pub fn get_http_method() -> Option<String> {
7686
APP_HELPERS.with(|helpers| {
7787
helpers

0 commit comments

Comments
 (0)