[core] Fix: Do not retry any request with body

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-12-24 22:14:24 +01:00
parent dbb9aae82a
commit f7d1f09b5c
Signed by: luzifer
GPG Key ID: 0066F03ED215AD7D

View File

@ -16,7 +16,6 @@ import (
log "github.com/sirupsen/logrus"
"github.com/Luzifer/go_helpers/v2/backoff"
"github.com/Luzifer/go_helpers/v2/str"
)
const (
@ -604,9 +603,8 @@ func (c *Client) request(opts clientRequestOpts) error {
}).Trace("Execute Twitch API request")
var retries uint64 = twitchRequestRetries
if str.StringInSlice(opts.Method, []string{
http.MethodPost, // Creates stuff, must not be retried without being asked
}) {
if opts.Body != nil {
// Body must be read only once, do not retry
retries = 1
}