We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0d71f29 commit dac5e66Copy full SHA for dac5e66
models/rate_limit.go
@@ -15,7 +15,7 @@ type TypeRatelimit struct {
15
func GetLimit(httpResp *http.Response, key string) int {
16
if val, ok := httpResp.Header[key]; ok {
17
rateLimit, err := strconv.Atoi(val[0])
18
- if err == nil {
+ if err != nil {
19
fmt.Println(err)
20
return 0
21
}
@@ -26,8 +26,9 @@ func GetLimit(httpResp *http.Response, key string) int {
26
27
func GetRatelimit(httpResp *http.Response) TypeRatelimit {
28
return TypeRatelimit {
29
- Remaining: GetLimit(httpResp, "X-Ratelimit-Refresh"),
+ Remaining: GetLimit(httpResp, "X-Ratelimit-Remaining"),
30
Limit: GetLimit(httpResp, "X-Ratelimit-Limit"),
31
- Refresh: GetLimit(httpResp, "X-Ratelimit-Remaining"),
+ Refresh: GetLimit(httpResp, "X-Ratelimit-Refresh"),
32
33
-}
+}
34
+
0 commit comments