Files
compiler-explorer/static
Matt GodboltandClaude e7f2bcdc93 Enhance HTTP utilities with automatic JSON handling and fix Accept headers
## Key improvements:

**Auto-stringification and Content-Type headers:**
- safeFetch now automatically stringifies object bodies and sets Content-Type: application/json
- Smart Accept header logic: only adds Accept: application/json when parseAs: 'json'
- Reduces boilerplate and prevents header regression issues

**Enhanced type safety:**
- New SafeFetchOptions interface supports object bodies
- Cleaner API: `body: request` instead of `body: JSON.stringify(request)`
- All manual header management removed from API calls

**Fix original regression:**
- Added Accept headers to sharing.ts shortener API (was missing after jQuery migration)
- Added Accept header to libs-widget.ts external API calls
- Simplified compiler-service.ts HTTP calls

**Comprehensive tests:**
- New compiler-service-tests.ts with helper for cleaner assertions
- Updated http-utils-tests.ts to match new smart header behavior
- Enhanced _setup-dom.ts for better test environment

This resolves the Cypress CI failures caused by missing Accept headers and
significantly improves the developer experience of the HTTP utilities.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-31 13:52:04 -05:00
..
2025-07-28 10:34:46 -05:00
2025-07-28 10:34:46 -05:00
2025-07-28 10:34:46 -05:00
2025-07-28 10:34:46 -05:00
2025-06-18 09:04:23 -05:00
2025-06-19 08:46:57 -05:00
2025-07-28 10:34:46 -05:00
2025-02-26 02:07:09 +02:00
2025-07-28 10:34:46 -05:00
2025-06-18 09:04:23 -05:00
2025-07-28 10:34:46 -05:00
2025-04-24 12:10:37 -05:00
2025-07-28 10:34:46 -05:00
2025-07-28 10:34:46 -05:00
2025-07-28 10:34:46 -05:00
2025-07-28 10:34:46 -05:00