Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/github/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 13 additions & 1 deletion pkg/github/notifications_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}),
Expand Down
Loading