mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-09-29 02:52:10 +08:00
handle 403 status code
This commit is contained in:
@@ -153,6 +153,10 @@ func getMilestone(repository string, version, username *string) (*Milestone, err
|
|||||||
}
|
}
|
||||||
defer res.Body.Close()
|
defer res.Body.Close()
|
||||||
|
|
||||||
|
if res.StatusCode != http.StatusOK {
|
||||||
|
return nil, errors.New("API rate limit exceeded")
|
||||||
|
}
|
||||||
|
|
||||||
milestones := make([]*Milestone, 0)
|
milestones := make([]*Milestone, 0)
|
||||||
if err = json.NewDecoder(res.Body).Decode(&milestones); err != nil {
|
if err = json.NewDecoder(res.Body).Decode(&milestones); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -176,6 +180,10 @@ func getIssues(repository string, milestone *Milestone, username *string) ([]*Is
|
|||||||
}
|
}
|
||||||
defer res.Body.Close()
|
defer res.Body.Close()
|
||||||
|
|
||||||
|
if res.StatusCode != http.StatusOK {
|
||||||
|
return nil, errors.New("API rate limit exceeded")
|
||||||
|
}
|
||||||
|
|
||||||
issues := make([]*Issue, 0)
|
issues := make([]*Issue, 0)
|
||||||
if err = json.NewDecoder(res.Body).Decode(&issues); err != nil {
|
if err = json.NewDecoder(res.Body).Decode(&issues); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -185,7 +193,7 @@ func getIssues(repository string, milestone *Milestone, username *string) ([]*Is
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
version := flag.String("v", "0.11.0", "Version of release, example: -v=1.0.0")
|
version := flag.String("v", "1.0.0", "Version of release, example: -v=1.0.0")
|
||||||
username := flag.String("u", "", "GitHub username for request, example: -u=octocat")
|
username := flag.String("u", "", "GitHub username for request, example: -u=octocat")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
Reference in New Issue
Block a user