Last active
December 22, 2015 01:05
-
-
Save KiChjang/f22b1dbac1b745c59fca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// BEFORE | |
if authentication_fetch_flag { | |
let current_url = http_request.borrow().current_url(); | |
if includes_credentials(current_url) { | |
authorization_value = Basic { | |
username: "", | |
password: None | |
}; | |
if let Some(name) = current_url.username() { | |
authorization_value.username = name.to_owned(); | |
} | |
if let Some(pass) = current_url.password() { | |
authorization_value.password = pass.to_owned(); | |
} | |
} | |
} | |
// AFTER | |
if authentication_fetch_flag { | |
let current_url = http_request.borrow().current_url(); | |
authorization_value = if includes_credentials(current_url) { | |
Some( Basic { | |
username: current_url.username().unwrap_or("").to_owned(), | |
password: current_url.password().map(to_owned) | |
}) | |
} else { None }; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment