Skip to content

Conversation

@Programador-jr
Copy link
Owner

Description:
This PR introduces multiple improvements to error handling, language detection, and the image request route.

  • [Language Detection for Images Route]: The error message when an image is not found (404 changed to 400) now adapts to the user's system language (en or pt, defaulting to en).
  • [Language Detection for API Status Route]: The root (/) endpoint now returns the API status message in the user's language (en or pt, defaulting to en).
  • [Updated Image Request Route]: The route for fetching exercise images has been changed from /exercises/{exerciseName}/{imageIndex}.jpg to /api/exercises/{exerciseName}/{imageIndex}.jpg for better consistency with other endpoints.

Validation and Fixes:

  • Implemented Accept-Language header detection.
  • Adjusted error response logic for missing images.
  • Updated frontend references to use the new image request route.

Checklist:

  • Image route returns localized error messages.
  • Root API route returns localized status messages.
  • Default fallback to English if language is unsupported.
  • Updated image route to /api/exercises/....
  • Verified backwards compatibility for existing API clients.

Impact:
These updates improve API consistency, provide localized responses based on the user's system language, and ensure a standardized structure for accessing exercise images.

@vercel
Copy link

vercel bot commented Feb 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
exercise-api ✅ Ready (Inspect) Visit Preview Feb 23, 2025 11:10pm

@Programador-jr Programador-jr merged commit a3e2aba into main Feb 23, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants