-
-
Notifications
You must be signed in to change notification settings - Fork 45
Closed
Labels
↗️ medium priorityThis issue is crucialThis issue is crucial✨ enhancementNew feature or request or improvementNew feature or request or improvementbackendChanges related to apisChanges related to apishacktoberfestRelated to hacktoberfestRelated to hacktoberfest✨jaiIssues, PRs or questions related to the ✨jAI moduleIssues, PRs or questions related to the ✨jAI module
Description
Problem
Some error responses from the jAI search API endpoint (src/pages/api/jai/search.js) may not include the required CORS headers, which can cause issues for frontend clients making cross-origin requests.
Current Behavior
- CORS headers are included in most responses, but may be missing in some error scenarios (e.g., thrown errors, timeouts).
Expected Behavior
- All error responses, regardless of the error type, should include the correct CORS headers.
Location
File: src/pages/api/jai/search.js
Proposed Implementation
- Audit all error handling code paths.
- Ensure every error response includes the CORS headers defined at the top of the handler.
Example:
return Response.json(
{ error: 'Some error message' },
{ status: 400, headers: corsHeaders }
);Steps to Complete
- Review all error handling code.
- Add CORS headers to any missing error responses.
- Test with various error scenarios to confirm headers are present.
Definition of Done
- All error responses include CORS headers.
- No CORS errors occur in frontend clients due to missing headers.
- Existing functionality remains intact.
Metadata
Metadata
Assignees
Labels
↗️ medium priorityThis issue is crucialThis issue is crucial✨ enhancementNew feature or request or improvementNew feature or request or improvementbackendChanges related to apisChanges related to apishacktoberfestRelated to hacktoberfestRelated to hacktoberfest✨jaiIssues, PRs or questions related to the ✨jAI moduleIssues, PRs or questions related to the ✨jAI module