You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let config:RouterConfig = serde_json::from_str(r#"{"always_match_any_host":false,"ignore_header_case":false,"ignore_host_case":false,"ignore_marketing_query_params":true,"ignore_path_and_query_case":false,"marketing_query_params":["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],"pass_marketing_query_params_to_target":true}"#).expect("cannot deserialize");
let route_1:Rule = serde_json::from_str(r#"{"id":"rule-with-host-port","rank":0,"source":{"host":"example.org:8080","path":"/foo"},"status_code":302,"target":"http://example.org:8081/bar"}"#).expect("cannot deserialize");
let request = Request::new(PathAndQueryWithSkipped::from_config(&default_config,r#"/foo"#),r#"/foo"#.to_string(),Some(r#"example.org"#.to_string()),Some(r#"http"#.to_string()),None,None,None);
7002
+
let request_configured = Request::rebuild_with_config(&router.config,&request);
7003
+
let matched = router.match_request(&request_configured);
7004
+
let traces = router.trace_request(&request_configured);
7005
+
let routes_traces = Trace::<Rule>::get_routes_from_traces(&traces);
7006
+
7007
+
assert_eq!(!matched.is_empty(),false);
7008
+
assert_eq!(!routes_traces.is_empty(),false);
7009
+
7010
+
}
7011
+
7012
+
#[test]
7013
+
fntest_rule_host_port_2(){
7014
+
let router = setup_rule_host_port();
7015
+
let default_config = RouterConfig::default();
7016
+
let request = Request::new(PathAndQueryWithSkipped::from_config(&default_config,r#"/foo"#),r#"/foo"#.to_string(),Some(r#"example.org:4040"#.to_string()),Some(r#"http"#.to_string()),None,None,None);
7017
+
let request_configured = Request::rebuild_with_config(&router.config,&request);
7018
+
let matched = router.match_request(&request_configured);
7019
+
let traces = router.trace_request(&request_configured);
7020
+
let routes_traces = Trace::<Rule>::get_routes_from_traces(&traces);
7021
+
7022
+
assert_eq!(!matched.is_empty(),false);
7023
+
assert_eq!(!routes_traces.is_empty(),false);
7024
+
7025
+
}
7026
+
7027
+
#[test]
7028
+
fntest_rule_host_port_3(){
7029
+
let router = setup_rule_host_port();
7030
+
let default_config = RouterConfig::default();
7031
+
let request = Request::new(PathAndQueryWithSkipped::from_config(&default_config,r#"/foo"#),r#"/foo"#.to_string(),Some(r#"example.org:8080"#.to_string()),Some(r#"http"#.to_string()),None,None,None);
7032
+
let request_configured = Request::rebuild_with_config(&router.config,&request);
7033
+
let matched = router.match_request(&request_configured);
7034
+
let traces = router.trace_request(&request_configured);
7035
+
let routes_traces = Trace::<Rule>::get_routes_from_traces(&traces);
let config:RouterConfig = serde_json::from_str(r#"{"always_match_any_host":false,"ignore_header_case":false,"ignore_host_case":false,"ignore_marketing_query_params":true,"ignore_path_and_query_case":false,"marketing_query_params":["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],"pass_marketing_query_params_to_target":true}"#).expect("cannot deserialize");
0 commit comments