read post body for failures
Ted Unangst tedu@tedunangst.com
Sun, 24 Dec 2023 13:38:04 -0500
1 files changed,
4 insertions(+),
1 deletions(-)
jump to
M
activity.go
→
activity.go
@@ -93,12 +93,15 @@ resp, err := honkClient.Do(req)
if err != nil { return err } - resp.Body.Close() + defer resp.Body.Close() switch resp.StatusCode { case 200: case 201: case 202: default: + var buf [4096]byte + n, _ := resp.Body.Read(buf[:]) + dlog.Printf("post failure message: %s", buf[n:]) return fmt.Errorf("http post status: %d", resp.StatusCode) } ilog.Printf("successful post: %s %d", url, resp.StatusCode)