@@ -38,7 +38,6 @@ pub struct HttpRequestContext {
3838 pub request : IncomingHttpRequest ,
3939 pub response_headers : HashMap < String , String > ,
4040 pub response_status : http:: StatusCode ,
41- pub response_body : Option < Vec < u8 > > ,
4241}
4342
4443pub struct AppContext {
@@ -139,15 +138,6 @@ pub fn set_response_status(status: http::StatusCode) {
139138 } )
140139}
141140
142- // Set the HTTP response body directly (bypasses Result serialization)
143- pub fn set_response_body ( body : Vec < u8 > ) {
144- APP_HELPERS . with ( |helpers| {
145- if let Some ( ctx) = & mut helpers. borrow_mut ( ) . current_http_context {
146- ctx. response_body = Some ( body) ;
147- }
148- } )
149- }
150-
151141pub fn clear_http_request_context ( ) {
152142 APP_HELPERS . with ( |helpers| {
153143 helpers. borrow_mut ( ) . current_http_context = None ;
@@ -166,30 +156,10 @@ pub fn source() -> Address {
166156 } )
167157}
168158
169- /// Get query parameters from the current HTTP request path (manually parsed)
170- /// Returns None if not in an HTTP context or no query parameters present
171- /// NOTE: This manually parses the path string. For pre-parsed params, use get_parsed_query_params()
172- pub fn get_query_params ( ) -> Option < HashMap < String , String > > {
173- get_path ( ) . map ( |path| {
174- let mut params = HashMap :: new ( ) ;
175- if let Some ( query_start) = path. find ( '?' ) {
176- let query = & path[ query_start + 1 ..] ;
177- for pair in query. split ( '&' ) {
178- if let Some ( eq_pos) = pair. find ( '=' ) {
179- let key = pair[ ..eq_pos] . to_string ( ) ;
180- let value = pair[ eq_pos + 1 ..] . to_string ( ) ;
181- params. insert ( key, value) ;
182- }
183- }
184- }
185- params
186- } )
187- }
188-
189159/// Get the pre-parsed query parameters from the current HTTP request
190160/// Returns None if not in an HTTP context
191161/// This accesses the query_params field that Hyperware already parsed (includes URL decoding)
192- pub fn get_parsed_query_params ( ) -> Option < HashMap < String , String > > {
162+ pub fn get_query_params ( ) -> Option < HashMap < String , String > > {
193163 APP_HELPERS . with ( |helpers| {
194164 helpers
195165 . borrow ( )
0 commit comments