fix: add trailing slashes to prevent 307 redirects dropping POST bodies #73

Merged
cal merged 1 commits from fix/trailing-slash-307-redirect into main 2026-03-09 22:26:53 +00:00
Owner

Summary

  • The FastAPI database API returns 307 redirects for URLs without trailing slashes (e.g., /api/v3/plays/api/v3/plays/)
  • aiohttp follows these redirects but converts POST to GET, silently dropping the request body
  • This caused /submit-scorecard play-by-play and decision data to never persist despite the API returning success
  • Discovered when today's CHC@POR W12 games showed 0 plays in the database after 3 successful submissions

Changes

  • api/client.py: Ensure _build_url() always appends a trailing slash to prevent 307 redirects
  • tests/test_api_client.py: Update all mock URLs to include trailing slashes

Impact

All POST/PUT/PATCH/DELETE requests were affected. GET requests also received unnecessary 307 round-trips (no data loss, just latency). This fix eliminates all redirect overhead.

Test plan

  • 930 tests pass, 3 skipped
  • Deploy and have Diego re-submit CHC@POR W12G1 and W12G2 scorecards
  • Verify plays appear in database after re-submission

🤖 Generated with Claude Code

## Summary - The FastAPI database API returns 307 redirects for URLs without trailing slashes (e.g., `/api/v3/plays` → `/api/v3/plays/`) - aiohttp follows these redirects but converts POST to GET, silently dropping the request body - This caused `/submit-scorecard` play-by-play and decision data to never persist despite the API returning success - **Discovered when today's CHC@POR W12 games showed 0 plays in the database after 3 successful submissions** ## Changes - `api/client.py`: Ensure `_build_url()` always appends a trailing slash to prevent 307 redirects - `tests/test_api_client.py`: Update all mock URLs to include trailing slashes ## Impact All POST/PUT/PATCH/DELETE requests were affected. GET requests also received unnecessary 307 round-trips (no data loss, just latency). This fix eliminates all redirect overhead. ## Test plan - [x] 930 tests pass, 3 skipped - [ ] Deploy and have Diego re-submit CHC@POR W12G1 and W12G2 scorecards - [ ] Verify plays appear in database after re-submission 🤖 Generated with [Claude Code](https://claude.com/claude-code)
cal added 1 commit 2026-03-09 22:25:27 +00:00
fix: add trailing slashes to API URLs to prevent 307 redirects dropping POST bodies
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m13s
9379ba587a
The FastAPI server returns 307 redirects for URLs without trailing slashes.
aiohttp follows these redirects but converts POST to GET, silently dropping
the request body. This caused play-by-play and decision data from
/submit-scorecard to never be persisted to the database despite the API
returning success.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cal merged commit 52ab92523c into main 2026-03-09 22:26:53 +00:00
cal deleted branch fix/trailing-slash-307-redirect 2026-03-09 22:26:54 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/major-domo-v2#73
No description provided.