You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] POST /api/streak/freeze always returns 201 even when freeze already existed #1475
This issue is raised as part of GSSoC'26. Kindly consider assigning it to me.
Summary
In src/app/api/streak/freeze/route.ts, the POST handler always
returns HTTP 201 Created regardless of whether the freeze was newly
created or already existed:
The already_existed flag is correctly computed but the HTTP status
code is wrong for the already-existed case. Returning 201 when a
resource already exists violates REST semantics — 201 means a new
resource was created, while 200 means the request succeeded on an
existing resource.
Steps to Reproduce
Call POST /api/streak/freeze for a user
Call POST /api/streak/freeze again for the same user on the same day
Observe both responses return 201 — second should return 200
Expected Behavior
First freeze creation → 201 Created
Freeze already existed → 200 OK with already_existed: true
Actual Behavior
Both cases return 201 regardless of whether the freeze was new
or pre-existing.
Activity
Midoriya-w commentedon May 29, 2026
Hey @Priyanshu-byte-coder I discovered this bug while auditing the codebase and would love to fix it under GSSoC 2026. Can I get assigned?
github-actions commentedon May 29, 2026
Thanks for opening your first issue on DevTrack! 🎉
A maintainer will take a look shortly. In the meantime:
good first issueif you want somewhere to startIf you find DevTrack useful, a ⭐ star on the repo is always appreciated — it helps the project reach more developers!
Midoriya-w commentedon May 29, 2026
Hey @Priyanshu-byte-coder,
Just submitted a fix for this issue. The response now returns
201for a newly created freeze and200when the freeze already exists.PR: #1542
Looking forward to your feedback.
github-actions commentedon May 30, 2026
✅ Closed as completed!
If DevTrack has been useful, a ⭐ star on the repo helps the project grow and reach more developers.