Skip to content

Commit

Permalink
[enhance] add return status judge.
Browse files Browse the repository at this point in the history
  • Loading branch information
YinMo19 committed Jan 3, 2025
1 parent a2bedd1 commit 5911831
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions examples/req_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,18 @@ async fn main() -> Result<(), Box<dyn Error>> {
}
}

let _response = client
let response = client
.post("https://sso.hitsz.edu.cn:7002/cas/oauth2.0/authorize")
.form(&form_data)
.send()
.await?;

println!("{}", "Login success.".green().bold());
if response.status().is_success() {
println!("{}", "Login success.".green().bold());
} else {
println!("{}", "Login failed.".red().bold());
return Ok(());
}
// auth end.

if args.json {
Expand Down

0 comments on commit 5911831

Please sign in to comment.