Replace HTTP status codes for net/http constants.
This commit is contained in:
parent
f5b21ea2a0
commit
6c820412cf
1 changed files with 3 additions and 4 deletions
|
@ -104,15 +104,14 @@ func (s *Session) request(method, urlStr, contentType string, b []byte) (respons
|
||||||
fmt.Printf("API RESPONSE BODY :: [%s]\n", response)
|
fmt.Printf("API RESPONSE BODY :: [%s]\n", response)
|
||||||
}
|
}
|
||||||
|
|
||||||
// See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
|
|
||||||
switch resp.StatusCode {
|
switch resp.StatusCode {
|
||||||
|
|
||||||
case 200: // OK
|
case http.StatusOK:
|
||||||
case 204: // No Content
|
case http.StatusNoContent:
|
||||||
|
|
||||||
// TODO check for 401 response, invalidate token if we get one.
|
// TODO check for 401 response, invalidate token if we get one.
|
||||||
|
|
||||||
case 429: // TOO MANY REQUESTS - Rate limiting
|
case http.StatusTooManyRequests: // Rate limiting
|
||||||
rl := RateLimit{}
|
rl := RateLimit{}
|
||||||
err = json.Unmarshal(response, &rl)
|
err = json.Unmarshal(response, &rl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue