- 24 tests covering all X-Resource routes - Mock Gotify server for message/application CRUD - Error cases: nil gotify, invalid JSON, missing fields, 429, 500 - Fix readError() to handle io.ReadAll failure - GotifyClient direct tests for all 7 methods
This commit is contained in:
@@ -252,6 +252,9 @@ func (c *GotifyClient) DeleteApplication(id int) error {
|
||||
// --- Helpers ---
|
||||
|
||||
func (c *GotifyClient) readError(resp *http.Response) error {
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return fmt.Errorf("gotify API error (HTTP %d): failed to read body: %w", resp.StatusCode, err)
|
||||
}
|
||||
return fmt.Errorf("gotify API error (HTTP %d): %s", resp.StatusCode, string(body))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user