Skip to content

Commit

Permalink
[minor]Little simplification - response(asStringAlways) and no need…
Browse files Browse the repository at this point in the history
… for `getOrElse(throw...)`
  • Loading branch information
amorfis committed Jan 22, 2025
1 parent ad53833 commit c7b7fdf
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ object SessionManager {
println("Successfully logged in. Got session ID: " + sessionId)

// open page with action that attacker wants to perform. Notice the CSRF token.
val changePasswordPage = basicRequest.get(uri"http://localhost:8080/changePasswordForm").cookie(SessionCookie, sessionId).send(backend)
val changePasswordFormBody = changePasswordPage.body.getOrElse(throw new RuntimeException("Body is Left"))
val changePasswordPage = basicRequest.get(uri"http://localhost:8080/changePasswordForm").cookie(SessionCookie, sessionId).response(asStringAlways).send(backend)
val changePasswordFormBody = changePasswordPage.body
println("Got change password form. Notice the CSRF token: " + changePasswordFormBody)
val regex: Regex = """<input type="hidden" name="csrfToken" value="(.*)">""".r
val maybeMatch = regex.findFirstMatchIn(changePasswordFormBody)
Expand Down

0 comments on commit c7b7fdf

Please sign in to comment.