Skip to content

Commit dac5e66

Browse files
alexwestsideBrandonRomano
authored andcommittedMay 16, 2018
fix error (#40)
* add rate limits to error wrapper * Update rate_limit.go * Replace Refresh <--->Remaining Replace Refresh <--->Remaining * Update rate_limit.go * fix model/rate_linit.go
1 parent 0d71f29 commit dac5e66

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
 

Diff for: ‎models/rate_limit.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type TypeRatelimit struct {
1515
func GetLimit(httpResp *http.Response, key string) int {
1616
if val, ok := httpResp.Header[key]; ok {
1717
rateLimit, err := strconv.Atoi(val[0])
18-
if err == nil {
18+
if err != nil {
1919
fmt.Println(err)
2020
return 0
2121
}
@@ -26,8 +26,9 @@ func GetLimit(httpResp *http.Response, key string) int {
2626

2727
func GetRatelimit(httpResp *http.Response) TypeRatelimit {
2828
return TypeRatelimit {
29-
Remaining: GetLimit(httpResp, "X-Ratelimit-Refresh"),
29+
Remaining: GetLimit(httpResp, "X-Ratelimit-Remaining"),
3030
Limit: GetLimit(httpResp, "X-Ratelimit-Limit"),
31-
Refresh: GetLimit(httpResp, "X-Ratelimit-Remaining"),
31+
Refresh: GetLimit(httpResp, "X-Ratelimit-Refresh"),
3232
}
33-
}
33+
}
34+

0 commit comments

Comments
 (0)
Please sign in to comment.