From 9a28dc729e78072e35315ec6fc9d183ca4170758 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 13 Dec 2024 20:07:26 +0200 Subject: [PATCH] Revert "twittermeow: retry certain 403s" This reverts commit ba548df38202f756dcafdf5ebdb5a1563e207c6b. --- pkg/twittermeow/http.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pkg/twittermeow/http.go b/pkg/twittermeow/http.go index 356749a..edcd77e 100644 --- a/pkg/twittermeow/http.go +++ b/pkg/twittermeow/http.go @@ -24,7 +24,6 @@ var ( ErrRequestFailed = errors.New("failed to send request") ErrResponseReadFailed = errors.New("failed to read response body") ErrMaxRetriesReached = errors.New("maximum retries reached") - ErrGeneric403 = errors.New("HTTP 403") ) func (c *Client) MakeRequest(url string, method string, headers http.Header, payload []byte, contentType types.ContentType) (*http.Response, []byte, error) { @@ -47,7 +46,7 @@ func (c *Client) MakeRequest(url string, method string, headers http.Header, pay Dur("duration", dur). Msg("Request successful") return resp, respDat, nil - } else if resp != nil && resp.StatusCode >= 400 && resp.StatusCode < 502 && !errors.Is(err, ErrGeneric403) { + } else if resp != nil && resp.StatusCode >= 400 && resp.StatusCode < 502 { c.Logger.Err(err). Str("url", url). Str("method", method). @@ -114,9 +113,6 @@ func (c *Client) makeRequestDirect(url string, method string, headers http.Heade if json.Unmarshal(responseBody, &respErr) == nil { return response, responseBody, fmt.Errorf("HTTP %d: %w", response.StatusCode, &respErr) } else if len(responseBody) < 512 { - if response.StatusCode == 403 { - return response, responseBody, fmt.Errorf("%w: %s", ErrGeneric403, responseBody) - } return response, responseBody, fmt.Errorf("HTTP %d: %s", response.StatusCode, responseBody) } return response, responseBody, fmt.Errorf("HTTP %d (%d bytes of data)", response.StatusCode, len(responseBody))