Skip to content

Conversation

@nicknisi
Copy link
Member

The library is incorrectly expecting all responses passed through our loader wrapper to be returning JSON. This diff adds a check and passes through non-JSON responses without modifying the response body.

@nicknisi nicknisi requested a review from Copilot March 27, 2025 00:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the issue where non-JSON responses were being modified by the loader wrapper. The changes introduce a new function to check for JSON responses and modify session handling to bypass these responses when they are not JSON.

  • Added an isJsonResponse helper in utils.ts
  • Updated the session handling in session.ts to return non-JSON responses unmodified
  • Added test coverage in session.spec.ts for non-JSON responses

Reviewed Changes

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

File Description
src/utils.ts Added helper function isJsonResponse to detect JSON responses.
src/session.ts Modified response handling to bypass non-JSON content.
src/session.spec.ts Added tests to verify non-JSON responses are returned correctly.

@nicknisi nicknisi merged commit 217dd17 into main Mar 27, 2025
6 checks passed
@nicknisi nicknisi deleted the nicknisi/non-json-responses branch March 27, 2025 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants