@@ -43,7 +43,6 @@ pub struct HttpRequestContext {
4343 pub request : IncomingHttpRequest ,
4444 pub response_headers : HashMap < String , String > ,
4545 pub response_status : http:: StatusCode ,
46- pub response_body : Option < Vec < u8 > > ,
4746}
4847
4948pub struct AppContext {
@@ -144,15 +143,6 @@ pub fn set_response_status(status: http::StatusCode) {
144143 } )
145144}
146145
147- // Set the HTTP response body directly (bypasses Result serialization)
148- pub fn set_response_body ( body : Vec < u8 > ) {
149- APP_HELPERS . with ( |helpers| {
150- if let Some ( ctx) = & mut helpers. borrow_mut ( ) . current_http_context {
151- ctx. response_body = Some ( body) ;
152- }
153- } )
154- }
155-
156146pub fn clear_http_request_context ( ) {
157147 APP_HELPERS . with ( |helpers| {
158148 helpers. borrow_mut ( ) . current_http_context = None ;
@@ -171,30 +161,10 @@ pub fn source() -> Address {
171161 } )
172162}
173163
174- /// Get query parameters from the current HTTP request path (manually parsed)
175- /// Returns None if not in an HTTP context or no query parameters present
176- /// NOTE: This manually parses the path string. For pre-parsed params, use get_parsed_query_params()
177- pub fn get_query_params ( ) -> Option < HashMap < String , String > > {
178- get_path ( ) . map ( |path| {
179- let mut params = HashMap :: new ( ) ;
180- if let Some ( query_start) = path. find ( '?' ) {
181- let query = & path[ query_start + 1 ..] ;
182- for pair in query. split ( '&' ) {
183- if let Some ( eq_pos) = pair. find ( '=' ) {
184- let key = pair[ ..eq_pos] . to_string ( ) ;
185- let value = pair[ eq_pos + 1 ..] . to_string ( ) ;
186- params. insert ( key, value) ;
187- }
188- }
189- }
190- params
191- } )
192- }
193-
194164/// Get the pre-parsed query parameters from the current HTTP request
195165/// Returns None if not in an HTTP context
196166/// This accesses the query_params field that Hyperware already parsed (includes URL decoding)
197- pub fn get_parsed_query_params ( ) -> Option < HashMap < String , String > > {
167+ pub fn get_query_params ( ) -> Option < HashMap < String , String > > {
198168 APP_HELPERS . with ( |helpers| {
199169 helpers
200170 . borrow ( )
0 commit comments