Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion helpers/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func SanitizeString(input string) string {
}

func ValidateCookies(cookies types.Cookies) bool {
return cookies.CSRF != "" && cookies.JSESSIONID != "" && cookies.SERVERID != ""
return cookies.CSRF != "" && cookies.JSESSIONID != ""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 New session case lacks tests

The new SERVERID-free session case has no automated regression test. Existing refresh tests still supply SERVERID, so restoring the old requirement could break commands again without failing those tests.

Add tests for ValidateCookies, ValidateLogin, and GetSemDetails: accept CSRF plus JSESSIONID without SERVERID, and still reject either required value being empty. Exercise GetSemDetails without a cached result.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Codex Fix in Claude Code Fix in Cursor

}

func ExtractRowData(rowSelection *goquery.Selection) []string {
Expand Down
2 changes: 1 addition & 1 deletion helpers/login-validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
// ValidateLogin checks if the user is logged in by validating the cookies
// Returns true if the user is logged in, otherwise prints a message and returns false
func ValidateLogin(cookies types.Cookies) bool {
if cookies.CSRF == "" || cookies.JSESSIONID == "" || cookies.SERVERID == "" {
if cookies.CSRF == "" || cookies.JSESSIONID == "" {
StopHeadlineForOutput()
fmt.Println("Please login first using the cli-top login command")
return false
Expand Down
2 changes: 1 addition & 1 deletion helpers/sem-details.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func GetSemDetails(cookies types.Cookies, regNo string) ([]types.Semester, error
if cached, ok := getCachedSemesters(regNo); ok {
return cached, nil
}
if cookies.CSRF == "" || cookies.JSESSIONID == "" || cookies.SERVERID == "" {
if cookies.CSRF == "" || cookies.JSESSIONID == "" {
return nil, fmt.Errorf("please login first using the cli-top login command")
}
endpoints := []string{
Expand Down