1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-02 07:58:31 +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 {
return err
}
if resp.StatusCode != 200 {
if resp.StatusCode < 200 || resp.StatusCode > 299 {
resp.Body.Close()
return httpError(resp.StatusCode)
}
@ -291,14 +291,12 @@ func (backend *backendInfo) sendTopicNotice(topic string, added bool) error {
}
defer resp.Body.Close()
respBytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
respStr := string(respBytes)
if respStr != "ok" {
return ErrBackendNotOK{Code: resp.StatusCode, Response: respStr}
if resp.StatusCode < 200 || resp.StatusCode > 299 {
respBytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
return ErrBackendNotOK{Code: resp.StatusCode, Response: fmt.Sprintf("(error reading non-2xx response): %s", err.Error()}
}
return ErrBackendNotOK{Code: resp.StatusCode, Response: string(respBytes)}
}
backend.lastSuccessLock.Lock()