Skip to content

Commit

Permalink
fixes avelino#3211 handle status code 302 and 301
Browse files Browse the repository at this point in the history
  • Loading branch information
mrKappen committed Aug 30, 2020
1 parent c91dd41 commit 86cb0d9
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions test_stale_repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,16 @@ func testCommitAge(href string, oauthClient *http.Client, staleRepos *[]string,
if resp.StatusCode == 301 {
*staleRepos = append(*staleRepos, href+movedPermanently)
log.Printf("%s returned 301", href)
return
} else if resp.StatusCode == 302 {
*staleRepos = append(*staleRepos, href+status302)
log.Printf("%s returned 302", href)
return
} else if resp.StatusCode >= 400 {
*staleRepos = append(*staleRepos, href+deadLinkMessage)
log.Printf("%s might not exist!", href)
return
} else {
json.NewDecoder(resp.Body).Decode(&respObj)
isAged = len(respObj) == 0
}
json.NewDecoder(resp.Body).Decode(&respObj)
isAged = len(respObj) == 0
if isAged {
log.Printf("%s has not had a commit in a while", href)
*staleRepos = append(*staleRepos, href)
Expand Down

0 comments on commit 86cb0d9

Please sign in to comment.