diff --git a/pkg/github/notifications.go b/pkg/github/notifications.go index 1de24fb0d..1d695beb3 100644 --- a/pkg/github/notifications.go +++ b/pkg/github/notifications.go @@ -231,7 +231,7 @@ func DismissNotification(t translations.TranslationHelperFunc) inventory.ServerT } defer func() { _ = resp.Body.Close() }() - if resp.StatusCode != http.StatusResetContent && resp.StatusCode != http.StatusOK { + if resp.StatusCode != http.StatusResetContent && resp.StatusCode != http.StatusNoContent && resp.StatusCode != http.StatusOK { body, err := io.ReadAll(resp.Body) if err != nil { return utils.NewToolResultErrorFromErr("failed to read response body", err), nil, nil diff --git a/pkg/github/notifications_test.go b/pkg/github/notifications_test.go index 936a70df4..d2124ae3d 100644 --- a/pkg/github/notifications_test.go +++ b/pkg/github/notifications_test.go @@ -472,7 +472,19 @@ func Test_DismissNotification(t *testing.T) { expectRead: true, }, { - name: "mark as done", + name: "mark as done with 204 response", + mockedClient: MockHTTPClientWithHandlers(map[string]http.HandlerFunc{ + DeleteNotificationsThreadsByThreadID: mockResponse(t, http.StatusNoContent, nil), + }), + requestArgs: map[string]interface{}{ + "threadID": "123", + "state": "done", + }, + expectError: false, + expectDone: true, + }, + { + name: "mark as done with 200 response", mockedClient: MockHTTPClientWithHandlers(map[string]http.HandlerFunc{ DeleteNotificationsThreadsByThreadID: mockResponse(t, http.StatusOK, nil), }),