mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-12 01:45:29 -04:00
refactor(sdk): Reduce the output size of get_header.
This patch reduces the size of the output's `Result::Err` variant of `get_header` from 160 bytes to 8 bytes.
This commit is contained in:
@@ -39,12 +39,14 @@ type Etag = String;
|
||||
fn get_header(
|
||||
header_map: &HeaderMap,
|
||||
header_name: &HeaderName,
|
||||
) -> Result<String, FromHttpResponseError<RumaApiError>> {
|
||||
) -> Result<String, Box<FromHttpResponseError<RumaApiError>>> {
|
||||
let header = header_map
|
||||
.get(header_name)
|
||||
.ok_or(HeaderDeserializationError::MissingHeader(ETAG.to_string()))?;
|
||||
.ok_or(HeaderDeserializationError::MissingHeader(ETAG.to_string()))
|
||||
.map_err(|error| Box::new(FromHttpResponseError::from(error)))?;
|
||||
|
||||
let header = header.to_str()?.to_owned();
|
||||
let header =
|
||||
header.to_str().map_err(|error| Box::new(FromHttpResponseError::from(error)))?.to_owned();
|
||||
|
||||
Ok(header)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user