@@ -945,20 +945,9 @@ fn generate_async_handler_arm(
945945 // Updated pattern to match struct variant with no fields
946946 quote ! {
947947 HPMRequest :: #variant_name{ } => {
948- // Capture context values before async execution
949- let current_path = hyperware_app_common:: get_path( ) ;
950- let current_method = hyperware_app_common:: get_http_method( ) ;
951-
952948 // Create a raw pointer to state for use in the async block
953949 let state_ptr: * mut #self_ty = state;
954950 hyperware_app_common:: hyper! {
955- // Restore context in the async task
956- hyperware_app_common:: APP_HELPERS . with( |ctx| {
957- let mut ctx_mut = ctx. borrow_mut( ) ;
958- ctx_mut. current_path = current_path;
959- ctx_mut. current_http_method = current_method;
960- } ) ;
961-
962951 // Inside the async block, use the pointer to access state
963952 let result = unsafe { ( * state_ptr) . #fn_name( ) . await } ;
964953 #response_handling
@@ -970,21 +959,9 @@ fn generate_async_handler_arm(
970959 quote ! {
971960 HPMRequest :: #variant_name( param) => {
972961 let param_captured = param; // Capture param before moving into async block
973-
974- // Capture context values before async execution
975- let current_path = hyperware_app_common:: get_path( ) ;
976- let current_method = hyperware_app_common:: get_http_method( ) ;
977-
978962 // Create a raw pointer to state for use in the async block
979963 let state_ptr: * mut #self_ty = state;
980964 hyperware_app_common:: hyper! {
981- // Restore context in the async task
982- hyperware_app_common:: APP_HELPERS . with( |ctx| {
983- let mut ctx_mut = ctx. borrow_mut( ) ;
984- ctx_mut. current_path = current_path;
985- ctx_mut. current_http_method = current_method;
986- } ) ;
987-
988965 // Inside the async block, use the pointer to access state
989966 let result = unsafe { ( * state_ptr) . #fn_name( param_captured) . await } ;
990967 #response_handling
@@ -1006,21 +983,9 @@ fn generate_async_handler_arm(
1006983 HPMRequest :: #variant_name( #( #param_names) , * ) => {
1007984 // Capture all parameters before moving into async block
1008985 #( #capture_statements) *
1009-
1010- // Capture context values before async execution
1011- let current_path = hyperware_app_common:: get_path( ) ;
1012- let current_method = hyperware_app_common:: get_http_method( ) ;
1013-
1014986 // Create a raw pointer to state for use in the async block
1015987 let state_ptr: * mut #self_ty = state;
1016988 hyperware_app_common:: hyper! {
1017- // Restore context in the async task
1018- hyperware_app_common:: APP_HELPERS . with( |ctx| {
1019- let mut ctx_mut = ctx. borrow_mut( ) ;
1020- ctx_mut. current_path = current_path;
1021- ctx_mut. current_http_method = current_method;
1022- } ) ;
1023-
1024989 // Inside the async block, use the pointer to access state
1025990 let result = unsafe { ( * state_ptr) . #fn_name( #( #captured_names) , * ) . await } ;
1026991 #response_handling
0 commit comments