-
Notifications
You must be signed in to change notification settings - Fork 736
Labels
FOSSHack 2026FOSSHack 2026 HackathonFOSSHack 2026 HackathonbackendFlask backend issuesFlask backend issuesbugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
Description
Several API endpoints pass `request.json` directly to schema validation without checking if it's `None`. If a client sends a request with no JSON body or incorrect Content-Type, this results in an unhandled error instead of a clean error response.
Affected Files
- `restx_api/market_holidays.py` (line 30)
- `restx_api/symbol.py` (line 30)
- `restx_api/intervals.py` (line 31)
Reference Implementation
`restx_api/option_greeks.py` (line 84) already handles this correctly:
```python
if request.json is None:
return make_response(jsonify({
"status": "error",
"message": "Request body must be JSON"
}), 400)
data = schema.load(request.json)
```
What to Do
- Add the null check before schema validation in each affected file
- Follow the pattern from `option_greeks.py`
Acceptance Criteria
- All three files validate `request.json` is not None
- Returns 400 with clear error message for non-JSON requests
- Existing valid requests still work
Skills You'll Learn
- API input validation
- Defensive programming
- Flask request handling
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
FOSSHack 2026FOSSHack 2026 HackathonFOSSHack 2026 HackathonbackendFlask backend issuesFlask backend issuesbugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers