AOSSIE-Org / AOSSIE-Org/EduAid
[BUG]: Backend endpoints return inconsistent error formats (HTML vs JSON)
- Vorherrschende Sprache
- JavaScript
- Sterne
- 171
- Forks
- 425
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
### Bug Description
Several backend endpoints return **HTML error pages** instead of JSON for error cases such as invalid input, incorrect HTTP methods, or unexpected failures.
This causes frontend failures when clients attempt to parse responses using `response.json()` and leads to inconsistent and unreliable error handling across the application.
Currently, some routes return JSON errors while others fall back to Flask’s default HTML error responses, breaking the API contract.
### Steps to Reproduce
1. Start the backend server
2. Send a request with missing or invalid input, for example:
- `POST /get_mcq` with an empty JSON body `{}`
3. Or send a request using an incorrect HTTP method:
- `POST /getTranscript` (endpoint only supports GET)
4. Observe the response format
### Logs and Screenshots
Example response observed before the fix:
This causes frontend parsing failures when calling `response.json()`.
### Environment Details
- OS: Windows 10
- Backend: Python (Flask)
- Client used for testing: Thunder Client (VS Code)
- Browser (frontend context): Chrome
### Impact
High - Major feature is broken
### Code of Conduct
- [x] I have joined the [Discord server](https://discord.gg/hjUhu33uAn) and will post updates there
- [x] I have searched existing issues to avoid duplicates
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.