mirror of
https://github.com/packwiz/packwiz.git
synced 2025-04-18 20:46:30 +02:00
github: Handle empty x-ratelimit-remaining header
Signed-off-by: unilock <unilock@fennet.rentals>
This commit is contained in:
parent
3859b37267
commit
72afdee4d8
@ -37,9 +37,15 @@ func (c *ghApiClient) makeGet(url string) (*http.Response, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ratelimit, err := strconv.Atoi(resp.Header.Get("x-ratelimit-remaining"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
// TODO: there is likely a better way to do this
|
||||
ratelimit := 999
|
||||
|
||||
ratelimit_header := resp.Header.Get("x-ratelimit-remaining")
|
||||
if ratelimit_header != "" {
|
||||
ratelimit, err = strconv.Atoi(ratelimit_header)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if resp.StatusCode == 403 && ratelimit == 0 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user