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:
parent
4ae3cca6ac
commit
3b3457af14
1 changed files with 7 additions and 9 deletions
|
@ -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()
|
||||||
|
|
||||||
|
if resp.StatusCode < 200 || resp.StatusCode > 299 {
|
||||||
respBytes, err := ioutil.ReadAll(resp.Body)
|
respBytes, err := ioutil.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return ErrBackendNotOK{Code: resp.StatusCode, Response: fmt.Sprintf("(error reading non-2xx response): %s", err.Error()}
|
||||||
}
|
}
|
||||||
|
return ErrBackendNotOK{Code: resp.StatusCode, Response: string(respBytes)}
|
||||||
respStr := string(respBytes)
|
|
||||||
if respStr != "ok" {
|
|
||||||
return ErrBackendNotOK{Code: resp.StatusCode, Response: respStr}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
backend.lastSuccessLock.Lock()
|
backend.lastSuccessLock.Lock()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue