moving code around

This commit is contained in:
Felipe Noronha 2022-04-13 22:58:56 -03:00
parent 6a8d181b77
commit e52cb8f844

View File

@ -240,14 +240,6 @@ fn forward_uri<B>(forward_url: &str, req: &Request<B>) -> String {
if forward_url_query.is_empty() { if forward_url_query.is_empty() {
url.push_str(req.uri().query().unwrap_or("")); url.push_str(req.uri().query().unwrap_or(""));
} else { } else {
let forward_query_items = forward_url_query
.split('&')
.map(|el| {
let parts = el.split('=').collect::<Vec<&str>>();
parts[0]
})
.collect::<Vec<_>>();
let request_query_items = req let request_query_items = req
.uri() .uri()
.query() .query()
@ -261,6 +253,14 @@ fn forward_uri<B>(forward_url: &str, req: &Request<B>) -> String {
}) })
.collect::<Vec<(&str, &str)>>(); .collect::<Vec<(&str, &str)>>();
let forward_query_items = forward_url_query
.split('&')
.map(|el| {
let parts = el.split('=').collect::<Vec<&str>>();
parts[0]
})
.collect::<Vec<_>>();
for (key, value) in request_query_items.iter() { for (key, value) in request_query_items.iter() {
if !forward_query_items.contains(key) { if !forward_query_items.contains(key) {
url.push_str(key); url.push_str(key);