| 180 | fn api_key_only_generates_header_for_header_mode() { |
| 181 | let query_param = AuthConfig { |
| 182 | auth_type: AuthType::ApiKey, |
| 183 | api_key_name: "X-Api-Key".to_string(), |
| 184 | api_key_value: "secret".to_string(), |
| 185 | api_key_in_header: false, |
| 186 | ..Default::default() |
| 187 | }; |
| 188 | let header = AuthConfig { |
| 189 | auth_type: AuthType::ApiKey, |
| 190 | api_key_name: "X-Api-Key".to_string(), |
| 191 | api_key_value: "secret".to_string(), |
| 192 | api_key_in_header: true, |
| 193 | ..Default::default() |
| 194 | }; |
| 195 | |
| 196 | assert_eq!(query_param.to_header(), None); |
| 197 | assert_eq!( |
| 198 | header.to_header(), |
| 199 | Some(("X-Api-Key".to_string(), "secret".to_string())) |
| 200 | ); |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | /// Authentication editor component |
| 205 | pub struct AuthEditor { |