mirror of
				https://github.com/dani-garcia/vaultwarden.git
				synced 2025-10-31 10:18:19 +02:00 
			
		
		
		
	Correctly camelCase acronyms
https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms
This commit is contained in:
		
							
								
								
									
										16
									
								
								src/util.rs
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								src/util.rs
									
									
									
									
									
								
							| @@ -38,9 +38,9 @@ impl Fairing for AppHeaders { | ||||
|     } | ||||
| } | ||||
|  | ||||
| pub struct CORS(); | ||||
| pub struct Cors(); | ||||
|  | ||||
| impl CORS { | ||||
| impl Cors { | ||||
|     fn get_header(headers: &HeaderMap, name: &str) -> String { | ||||
|         match headers.get_one(name) { | ||||
|             Some(h) => h.to_string(), | ||||
| @@ -51,7 +51,7 @@ impl CORS { | ||||
|     // Check a request's `Origin` header against the list of allowed origins. | ||||
|     // If a match exists, return it. Otherwise, return None. | ||||
|     fn get_allowed_origin(headers: &HeaderMap) -> Option<String> { | ||||
|         let origin = CORS::get_header(headers, "Origin"); | ||||
|         let origin = Cors::get_header(headers, "Origin"); | ||||
|         let domain_origin = CONFIG.domain_origin(); | ||||
|         let safari_extension_origin = "file://"; | ||||
|         if origin == domain_origin || origin == safari_extension_origin { | ||||
| @@ -62,10 +62,10 @@ impl CORS { | ||||
|     } | ||||
| } | ||||
|  | ||||
| impl Fairing for CORS { | ||||
| impl Fairing for Cors { | ||||
|     fn info(&self) -> Info { | ||||
|         Info { | ||||
|             name: "CORS", | ||||
|             name: "Cors", | ||||
|             kind: Kind::Response, | ||||
|         } | ||||
|     } | ||||
| @@ -73,14 +73,14 @@ impl Fairing for CORS { | ||||
|     fn on_response(&self, request: &Request, response: &mut Response) { | ||||
|         let req_headers = request.headers(); | ||||
|  | ||||
|         if let Some(origin) = CORS::get_allowed_origin(req_headers) { | ||||
|         if let Some(origin) = Cors::get_allowed_origin(req_headers) { | ||||
|             response.set_header(Header::new("Access-Control-Allow-Origin", origin)); | ||||
|         } | ||||
|  | ||||
|         // Preflight request | ||||
|         if request.method() == Method::Options { | ||||
|             let req_allow_headers = CORS::get_header(req_headers, "Access-Control-Request-Headers"); | ||||
|             let req_allow_method = CORS::get_header(req_headers, "Access-Control-Request-Method"); | ||||
|             let req_allow_headers = Cors::get_header(req_headers, "Access-Control-Request-Headers"); | ||||
|             let req_allow_method = Cors::get_header(req_headers, "Access-Control-Request-Method"); | ||||
|  | ||||
|             response.set_header(Header::new("Access-Control-Allow-Methods", req_allow_method)); | ||||
|             response.set_header(Header::new("Access-Control-Allow-Headers", req_allow_headers)); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user