mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-03 01:40:21 +08:00
OAuth refresh 隧道代理统一启用 follow-redirects
This commit is contained in:
@@ -1279,17 +1279,10 @@ impl AppState {
|
|||||||
.await;
|
.await;
|
||||||
let proxy_is_tunnel = local_oauth_proxy_is_tunnel(proxy_snapshot.as_ref());
|
let proxy_is_tunnel = local_oauth_proxy_is_tunnel(proxy_snapshot.as_ref());
|
||||||
let mut headers = request.headers.clone();
|
let mut headers = request.headers.clone();
|
||||||
if !proxy_is_tunnel {
|
headers.insert(
|
||||||
headers.insert(
|
EXECUTION_REQUEST_FOLLOW_REDIRECTS_HEADER.to_string(),
|
||||||
EXECUTION_REQUEST_FOLLOW_REDIRECTS_HEADER.to_string(),
|
"true".to_string(),
|
||||||
"true".to_string(),
|
);
|
||||||
);
|
|
||||||
} else {
|
|
||||||
headers.insert(
|
|
||||||
EXECUTION_REQUEST_HTTP1_ONLY_HEADER.to_string(),
|
|
||||||
"true".to_string(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
let plan = ExecutionPlan {
|
let plan = ExecutionPlan {
|
||||||
request_id: request.request_id.to_string(),
|
request_id: request.request_id.to_string(),
|
||||||
candidate_id: None,
|
candidate_id: None,
|
||||||
|
|||||||
@@ -4571,8 +4571,7 @@ async fn gateway_refreshes_admin_provider_oauth_key_locally_via_execution_runtim
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn gateway_refreshes_admin_provider_oauth_key_tunnel_proxy_without_follow_redirects_like_master(
|
async fn gateway_refreshes_admin_provider_oauth_key_tunnel_proxy_with_direct_refresh_controls() {
|
||||||
) {
|
|
||||||
let execution_plans = Arc::new(Mutex::new(Vec::<ExecutionPlan>::new()));
|
let execution_plans = Arc::new(Mutex::new(Vec::<ExecutionPlan>::new()));
|
||||||
let execution_plans_clone = Arc::clone(&execution_plans);
|
let execution_plans_clone = Arc::clone(&execution_plans);
|
||||||
let execution_runtime = Router::new().route(
|
let execution_runtime = Router::new().route(
|
||||||
@@ -4706,15 +4705,15 @@ async fn gateway_refreshes_admin_provider_oauth_key_tunnel_proxy_without_follow_
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
refresh_plan
|
refresh_plan
|
||||||
.headers
|
.headers
|
||||||
.get(EXECUTION_REQUEST_FOLLOW_REDIRECTS_HEADER),
|
.get(EXECUTION_REQUEST_FOLLOW_REDIRECTS_HEADER)
|
||||||
None
|
.map(String::as_str),
|
||||||
|
Some("true")
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
refresh_plan
|
refresh_plan
|
||||||
.headers
|
.headers
|
||||||
.get(EXECUTION_REQUEST_HTTP1_ONLY_HEADER)
|
.get(EXECUTION_REQUEST_HTTP1_ONLY_HEADER),
|
||||||
.map(String::as_str),
|
None
|
||||||
Some("true")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
gateway_handle.abort();
|
gateway_handle.abort();
|
||||||
|
|||||||
Reference in New Issue
Block a user