(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestHandleRedirects_AttachOrgToken(t *testing.T) { |
| 11 | req, _ := http.NewRequest("GET", "http://example.com/cdn-cgi/access/login", nil) |
| 12 | via := []*http.Request{} |
| 13 | orgToken := "orgTokenValue" |
| 14 | |
| 15 | _ = handleRedirects(req, via, orgToken) |
| 16 | |
| 17 | // Check if the orgToken cookie is attached |
| 18 | cookies := req.Cookies() |
| 19 | found := false |
| 20 | for _, cookie := range cookies { |
| 21 | if cookie.Name == tokenCookie && cookie.Value == orgToken { |
| 22 | found = true |
| 23 | break |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | if !found { |
| 28 | t.Errorf("OrgToken cookie not attached to the request.") |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | func TestHandleRedirects_AttachAppSessionCookie(t *testing.T) { |
| 33 | req, _ := http.NewRequest("GET", "http://example.com/cdn-cgi/access/authorized", nil) |
nothing calls this directly
no test coverage detected