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 e38d72c commit c91dd41
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions test_stale_repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,20 +174,22 @@ 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)
} else {
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)
ctr++
}
return
}
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)
ctr++
}
}
}
Expand Down

0 comments on commit c91dd41

Please sign in to comment.