mirror of
https://github.com/aljazceru/signal-cli-rest-api.git
synced 2025-12-19 15:44:28 +01:00
return HTTP status code 429 in case of rate limiting
This commit is contained in:
@@ -414,7 +414,7 @@ func (a *Api) SendV2(c *gin.Context) {
|
|||||||
case *client.RateLimitErrorType:
|
case *client.RateLimitErrorType:
|
||||||
if rateLimitError, ok := err.(*client.RateLimitErrorType); ok {
|
if rateLimitError, ok := err.(*client.RateLimitErrorType); ok {
|
||||||
extendedError := errors.New(err.Error() + ". Use the attached challenge tokens to lift the rate limit restrictions via the '/v1/accounts/{number}/rate-limit-challenge' endpoint.")
|
extendedError := errors.New(err.Error() + ". Use the attached challenge tokens to lift the rate limit restrictions via the '/v1/accounts/{number}/rate-limit-challenge' endpoint.")
|
||||||
c.JSON(400, SendMessageError{Msg: extendedError.Error(), ChallengeTokens: rateLimitError.ChallengeTokens})
|
c.JSON(429, SendMessageError{Msg: extendedError.Error(), ChallengeTokens: rateLimitError.ChallengeTokens})
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
c.JSON(400, Error{Msg: err.Error()})
|
c.JSON(400, Error{Msg: err.Error()})
|
||||||
|
|||||||
Reference in New Issue
Block a user