Fixed api returning html instead of json #42

Merged
Klick3R-1 merged 1 commit from fix-subscriptions-api-html-issue into main 2025-08-29 11:54:48 -04:00
Klick3R-1 commented 2025-08-28 22:35:25 -04:00 (Migrated from github.com)

The /api/v1/subscriptions endpoint was incorrectly returning HTML content instead of JSON data, causing API parsing errors.

Both web and API routes were using the same handler method designed for HTML responses.

Created a separate GetSubscriptionsAPI handler that returns JSON data, while keeping the web route unchanged.

The /api/v1/subscriptions endpoint was incorrectly returning HTML content instead of JSON data, causing API parsing errors. Both web and API routes were using the same handler method designed for HTML responses. Created a separate GetSubscriptionsAPI handler that returns JSON data, while keeping the web route unchanged.
bscott commented 2025-08-29 02:54:01 -04:00 (Migrated from github.com)

Thanks for the catch @Klick3R-1 , I'll merge in tomorrow

Thanks for the catch @Klick3R-1 , I'll merge in tomorrow
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2025-08-29 02:54:47 -04:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull Request Overview

This PR fixes an API endpoint that was incorrectly returning HTML instead of JSON data. The /api/v1/subscriptions endpoint was using a handler designed for web responses, causing API parsing errors.

  • Created a new GetSubscriptionsAPI handler that returns JSON data instead of HTML
  • Updated the API route to use the new JSON-specific handler
  • Kept the original web route handler unchanged to maintain existing functionality

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/handlers/subscription.go Added new GetSubscriptionsAPI method that returns JSON responses for API calls
cmd/server/main.go Updated API route to use the new JSON handler instead of the HTML handler

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

## Pull Request Overview This PR fixes an API endpoint that was incorrectly returning HTML instead of JSON data. The `/api/v1/subscriptions` endpoint was using a handler designed for web responses, causing API parsing errors. - Created a new `GetSubscriptionsAPI` handler that returns JSON data instead of HTML - Updated the API route to use the new JSON-specific handler - Kept the original web route handler unchanged to maintain existing functionality ### Reviewed Changes Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments. | File | Description | | ---- | ----------- | | internal/handlers/subscription.go | Added new `GetSubscriptionsAPI` method that returns JSON responses for API calls | | cmd/server/main.go | Updated API route to use the new JSON handler instead of the HTML handler | --- <sub>**Tip:** Customize your code reviews with copilot-instructions.md. <a href="/bscott/subtrackr/new/main/.github?filename=copilot-instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Create the file</a> or <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">learn how to get started</a>.</sub>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
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
bscott/subtrackr!42
No description provided.