1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-16 01:56:55 +00:00

allow 2xx from backend

This commit is contained in:
Kane York 2016-06-04 11:43:37 -07:00
parent 4ae3cca6ac
commit 3b3457af14

View file

@ -232,7 +232,7 @@ func (backend *backendInfo) SendAggregatedData(form url.Values) error {
if err != nil { if err != nil {
return err return err
} }
if resp.StatusCode != 200 { if resp.StatusCode < 200 || resp.StatusCode > 299 {
resp.Body.Close() resp.Body.Close()
return httpError(resp.StatusCode) return httpError(resp.StatusCode)
} }
@ -291,14 +291,12 @@ func (backend *backendInfo) sendTopicNotice(topic string, added bool) error {
} }
defer resp.Body.Close() defer resp.Body.Close()
respBytes, err := ioutil.ReadAll(resp.Body) if resp.StatusCode < 200 || resp.StatusCode > 299 {
if err != nil { respBytes, err := ioutil.ReadAll(resp.Body)
return err if err != nil {
} return ErrBackendNotOK{Code: resp.StatusCode, Response: fmt.Sprintf("(error reading non-2xx response): %s", err.Error()}
}
respStr := string(respBytes) return ErrBackendNotOK{Code: resp.StatusCode, Response: string(respBytes)}
if respStr != "ok" {
return ErrBackendNotOK{Code: resp.StatusCode, Response: respStr}
} }
backend.lastSuccessLock.Lock() backend.lastSuccessLock.Lock()