Skip to content

fix: return JSON 404 for unmatched API routes#840

Merged
alexluong merged 1 commit intomainfrom
fix/json-404-response
Apr 20, 2026
Merged

fix: return JSON 404 for unmatched API routes#840
alexluong merged 1 commit intomainfrom
fix/json-404-response

Conversation

@alexluong
Copy link
Copy Markdown
Collaborator

@alexluong alexluong commented Apr 17, 2026

Summary

  • Unmatched /api/... routes now return {"status": 404, "message": "not found"} instead of Gin's default plain-text 404 page not found
  • Both portal modes (proxy and embedded) updated with NoRoute handlers that check for /api/ prefix
  • Non-API routes continue to work as before (SPA fallback or proxy passthrough)

Test plan

  • Added embed_test.go covering both embedded and proxy modes
  • Manual: GET /api/v1/nonexistent returns JSON {"status":404,"message":"not found"} with Content-Type: application/json
  • Manual: Non-API routes still serve the portal SPA

🤖 Generated with Claude Code

Unmatched API routes (e.g. GET /api/v1/nonexistent) previously returned
Gin's default plain-text "404 page not found". Now they return a JSON
envelope consistent with the rest of the API:
{"status": 404, "message": "not found"}

Both portal modes (proxy and embedded) are updated. Non-API routes
continue to work as before (SPA fallback or proxy).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alexluong alexluong merged commit 705d369 into main Apr 20, 2026
2 checks passed
@alexluong alexluong deleted the fix/json-404-response branch April 20, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants