| 973 | |
| 974 | #[test] |
| 975 | fn auth_source_applies_headers() { |
| 976 | let auth = AuthSource::ApiKeyAndBearer { |
| 977 | api_key: "test-key".to_string(), |
| 978 | bearer_token: "proxy-token".to_string(), |
| 979 | }; |
| 980 | let request = auth |
| 981 | .apply(reqwest::Client::new().post("https://example.test")) |
| 982 | .build() |
| 983 | .expect("request build"); |
| 984 | let headers = request.headers(); |
| 985 | assert_eq!( |
| 986 | headers.get("x-api-key").and_then(|v| v.to_str().ok()), |
| 987 | Some("test-key") |
| 988 | ); |
| 989 | assert_eq!( |
| 990 | headers.get("authorization").and_then(|v| v.to_str().ok()), |
| 991 | Some("Bearer proxy-token") |
| 992 | ); |
| 993 | } |
| 994 | } |