Skip to content

Commit

Permalink
Small refactoring: get rid of unwrap()
Browse files Browse the repository at this point in the history
  • Loading branch information
abdolence committed Jun 28, 2024
1 parent 063152c commit 6f43d4a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/hyper_tokio/hyper_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ impl HyperExtensions {
request_builder: hyper::http::request::Builder,
token: Option<&SlackApiToken>,
) -> hyper::http::request::Builder {
if token.is_none() {
request_builder
} else {
let token_header_value = format!("Bearer {}", token.unwrap().token_value.value());
if let Some(existing_token) = token {
let token_header_value = format!("Bearer {}", existing_token.token_value.value());
let mut builder =
request_builder.header(hyper::header::AUTHORIZATION, token_header_value);
if let Some(cookie) = token.unwrap().cookie.clone() {
if let Some(cookie) = existing_token.cookie.clone() {
builder = builder.header(hyper::header::COOKIE, cookie.value())
}
builder
} else {
request_builder
}
}

Expand Down

0 comments on commit 6f43d4a

Please sign in to comment.