[BE][Classroom] Log html response on login http 302

master
fernando 2024-01-31 16:10:01 -05:00
parent 4e3f70d8e0
commit 31d7f0697c
1 changed files with 11 additions and 1 deletions

View File

@ -252,11 +252,21 @@ async fn login() -> Result<(), String> {
match response { match response {
Ok(mut r) => { Ok(mut r) => {
if r.status() == isahc::http::StatusCode::FOUND { if r.status() == isahc::http::StatusCode::FOUND {
// TODO: Even if this is a 302, it might not be a successful login let html = match r.text() {
Ok(t) => t,
Err(err) => {
return Err(format!("Error getting text from login response: {:?}", err))
}
};
log::info!("classroom login: 302 response.");
log_html(&html);
// check Set-Cookie header // check Set-Cookie header
SESSION_COOKIE.write().unwrap().jar = jar.clone(); SESSION_COOKIE.write().unwrap().jar = jar.clone();
Ok(()) Ok(())
} else { } else {
log::info!("classroom login: not 302");
// Write html to file // Write html to file
match r.text() { match r.text() {
Ok(t) => { Ok(t) => {