blossom: display body when upload fails and no reason is given.

This commit is contained in:
fiatjaf
2026-03-22 12:49:59 -03:00
parent e675f04bd2
commit a6fdcd8b30
+6
View File
@@ -58,6 +58,12 @@ func (c *Client) httpCall(
}
if resp.Header.StatusCode() >= 300 {
reason := resp.Header.Peek("X-Reason")
if len(reason) == 0 {
reason = resp.Body()
if len(reason) > 200 {
reason = append(reason[0:199], []byte("…")...)
}
}
return fmt.Errorf("%s returned an error (%d): %s", url, resp.StatusCode(), string(reason))
}