mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-06-23 17:20:51 +00:00
[Rust Server] Fix panic handling headers If we have an API which has multiple auth types, we may panic. This is because in Hyper 0.11, the following code will panic: ``` use hyper::header::{Authorization, Basic, Bearer, Headers}; fn main() { let mut headers = Headers::default(); let basic = Basic { username: "richard".to_string(), password: None }; headers.set::<Authorization<Basic>>(Authorization(basic)); println!("Auth: {:?}", headers.get::<Authorization<Bearer>>()); } ``` as it mixes up an `Authorization<Basic>` and `Authorization<Bearer>` as both have `Authorization:` as the header name. This is fixed by using `swagger::SafeHeaders` added in https://github.com/Metaswitch/swagger-rs/pull/90