(config: &Config, headers: &HeaderMap)
| 101 | } |
| 102 | |
| 103 | pub fn unauthorized_response(config: &Config, headers: &HeaderMap) -> Response { |
| 104 | let mut response = ( |
| 105 | StatusCode::UNAUTHORIZED, |
| 106 | Json(json!({ |
| 107 | "error": "SimDeck API access token is required.", |
| 108 | "ok": false, |
| 109 | "serverId": server_identity(config), |
| 110 | "advertiseHost": config.advertise_host, |
| 111 | "hostId": config.host_id, |
| 112 | "hostName": config.host_name, |
| 113 | "httpPort": config.http_port, |
| 114 | "serverKind": config.server_kind.as_str(), |
| 115 | })), |
| 116 | ) |
| 117 | .into_response(); |
| 118 | append_cors_headers(config, headers, response.headers_mut()); |
| 119 | response |
| 120 | } |
| 121 | |
| 122 | pub fn append_cors_headers( |
| 123 | config: &Config, |
no test coverage detected