File tree Expand file tree Collapse file tree
src/models/middleware/types Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -136,6 +136,11 @@ impl Middleware for JoltTransformMiddleware {
136136 }
137137 if let Some ( uri) = td_obj. get ( "uri" ) . and_then ( |v| v. as_str ( ) ) {
138138 target. uri = uri. to_string ( ) ;
139+ // If the new URI contains query params, clear existing query_params
140+ // to avoid duplication when full_url() appends them
141+ if uri. contains ( '?' ) {
142+ target. query_params . clear ( ) ;
143+ }
139144 }
140145 if let Some ( base_url) = td_obj. get ( "base_url" ) . and_then ( |v| v. as_str ( ) ) {
141146 target. base_url = base_url. to_string ( ) ;
@@ -148,6 +153,8 @@ impl Middleware for JoltTransformMiddleware {
148153 }
149154 }
150155 if let Some ( query_params) = td_obj. get ( "query_params" ) . and_then ( |v| v. as_object ( ) ) {
156+ // Replace existing query_params entirely (not merge)
157+ target. query_params . clear ( ) ;
151158 for ( k, v) in query_params {
152159 if let Some ( s) = v. as_str ( ) {
153160 target. query_params . insert ( k. clone ( ) , vec ! [ s. to_string( ) ] ) ;
You can’t perform that action at this time.
0 commit comments