prasoonk1204/BreatheEasy
[Bug] AQI backend APIs return HTML instead of JSON
Open
#134 opened on Mar 3, 2026
SWoC26bughelp wanted
Repository metrics
- Stars
- (22 stars)
- PR merge metrics
- (PR metrics pending)
Description
Describe the bug
The backend API endpoints for AQI data are returning HTML instead of the expected JSON responses. This causes the frontend to throw parsing errors. All requests to the following endpoints return HTML:
https://breathe-easy-1.vercel.app/api/aqi/current-location?https://breathe-easy-1.vercel.app/api/aqi/top-citieshttps://breathe-easy-1.vercel.app/api/aqi/city
Sample frontend error:
Error fetching AQI: SyntaxError: Unexpected token '<', "<!doctype "... is not valid JSON
Sample API response body:
<html lang="en">
<head>...</head>
<body>...</body>
</html>
This breaks air quality data display and prevents the app from loading AQI values.
Steps to Reproduce
- Make a GET request to any of the above API endpoints
- Observe that the response is HTML instead of JSON
- Frontend throws JSON parsing errors upon receiving this response
Expected behavior
All AQI API endpoints should respond with valid JSON objects as documented or expected by the frontend. If an error occurs, a JSON error response should be returned.
Additional context
- Ensure that all API endpoints return JSON with appropriate headers (e.g., Content-Type: application/json).
Checklist
- I have checked the existing issues to make sure this is not a duplicate.
- I have read the contribution guidelines.