This commit is contained in:
@@ -38,6 +38,12 @@ func HttpPostMessage(url string, msg []byte, timeout int) (response []byte, err
|
||||
defer resp.Body.Close()
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
// Server already accepted the request (2xx) — body truncation on our
|
||||
// side doesn't mean the message wasn't stored. Return what we have so
|
||||
// the caller doesn't retry and produce a duplicate.
|
||||
if resp.StatusCode >= 200 && resp.StatusCode < 300 {
|
||||
return body, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
return body, nil
|
||||
|
||||
Reference in New Issue
Block a user