Skip to content

Commit c5cb836

Browse files
committed
200 http status for available notifications
1 parent 42ef28e commit c5cb836

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

integrations/api_notification_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func TestAPINotification(t *testing.T) {
8383

8484
// -- check notifications --
8585
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/notifications/new?token=%s", token))
86-
resp = session.MakeRequest(t, req, http.StatusFound)
86+
resp = session.MakeRequest(t, req, http.StatusOK)
8787

8888
// -- mark notifications as read --
8989
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/notifications?token=%s", token))

routers/api/v1/notify/notifications.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ func NewAvailable(ctx *context.APIContext) {
1818
// ---
1919
// summary: Check if unread notifications exist
2020
// responses:
21+
// "200":
22+
// "$ref": "#/responses/NotificationCount"
2123
// "204":
2224
// description: No unread notification
23-
// "302":
24-
// "$ref": "#/responses/NotificationCount"
2525

2626
count := models.CountUnread(ctx.User)
2727

2828
if count > 0 {
29-
ctx.JSON(http.StatusFound, api.NotificationCount{New: count})
29+
ctx.JSON(http.StatusOK, api.NotificationCount{New: count})
3030
} else {
3131
ctx.Status(http.StatusNoContent)
3232
}

templates/swagger/v1_json.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,11 +502,11 @@
502502
"summary": "Check if unread notifications exist",
503503
"operationId": "notifyNewAvailable",
504504
"responses": {
505+
"200": {
506+
"$ref": "#/responses/NotificationCount"
507+
},
505508
"204": {
506509
"description": "No unread notification"
507-
},
508-
"302": {
509-
"$ref": "#/responses/NotificationCount"
510510
}
511511
}
512512
}

0 commit comments

Comments
 (0)