vendor: add github.com/koofr/go-koofrclient
* added koofr client SDK dep for koofr backend
This commit is contained in:
parent
27714e29c3
commit
1d14e30383
22 changed files with 1461 additions and 0 deletions
38
vendor/github.com/koofr/go-httpclient/errors.go
generated
vendored
Normal file
38
vendor/github.com/koofr/go-httpclient/errors.go
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
package httpclient
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type InvalidStatusError struct {
|
||||
Expected []int
|
||||
Got int
|
||||
Headers http.Header
|
||||
Content string
|
||||
}
|
||||
|
||||
func (e InvalidStatusError) Error() string {
|
||||
return fmt.Sprintf("Invalid response status! Got %d, expected %d; headers: %s, content: %s", e.Got, e.Expected, e.Headers, e.Content)
|
||||
}
|
||||
|
||||
func IsInvalidStatusError(err error) (invalidStatusError *InvalidStatusError, ok bool) {
|
||||
if ise, ok := err.(InvalidStatusError); ok {
|
||||
return &ise, true
|
||||
} else if ise, ok := err.(*InvalidStatusError); ok {
|
||||
return ise, true
|
||||
} else {
|
||||
return nil, false
|
||||
}
|
||||
}
|
||||
|
||||
func IsInvalidStatusCode(err error, statusCode int) bool {
|
||||
if ise, ok := IsInvalidStatusError(err); ok {
|
||||
return ise.Got == statusCode
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
var RateLimitTimeoutError = errors.New("HTTPClient rate limit timeout")
|
Loading…
Add table
Add a link
Reference in a new issue