14-07-2025
Pre-release
Pre-release
🛡️ API Response & Error Handling Overhaul
This release delivers a comprehensive overhaul of our API's response handling, ensuring that client applications receive data and errors in a consistent, predictable, and secure manner. We have standardized the format for both successful responses and critical error messages, while also fixing a significant CORS issue that impacted error visibility.
✨ Key Enhancements
Critical Error Handling & CORS Fix
- Fixed Unreadable Error Messages: Resolved a critical issue where browser-based clients could not read API error messages due to CORS policies. Error responses now dynamically include the necessary
Access-Control-Allow-Origin
headers, ensuring clients can always access detailed error information. - Centralized Error Generation: All JSON error responses are now generated by a single helper function, standardizing their format and ensuring consistent behavior across the API.
- New CORS Configuration: A new
CORS_ALLOWED_ORIGIN
environment variable has been introduced, allowing for explicit configuration of the allowed origin in production environments.
Standardized Success Responses
- New Response Helper: A
ResponseHelper
utility has been introduced to standardize the format of all successful API responses. This reduces boilerplate code in route handlers and ensures a consistentSuccessApiResponse
structure across all endpoints. - Widespread Refactoring: Numerous route handlers have been refactored to use the new helper, significantly cleaning up the codebase and improving maintainability.
🔧 Code Quality & Organization
- Improved Code Organization: The
RequestId
class has been moved to its own dedicated file for better modularity. - Logging Cleanup: Redundant request ID prefixes have been removed from log statements, as this is now handled more cleanly through the request context.