Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow raw response text to be read from event listeners #106

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

justisr
Copy link
Contributor

@justisr justisr commented Oct 27, 2024

Because response.text() cannot be called twice, it's currently impossible to read the response body if the response wasn't in html which limits the functionality event listeners can provide.

This change simply stores the raw text we've read in the response object that we're providing event listeners, so that they have access to that data as well.

 response.text() cannot be called twice without cloning first. Since we're calling it without cloning the response,
 we are making the raw text inaccessible to event listeners that want to access the response data, so let's cache the text we've read.
@imacrayon imacrayon merged commit 20fb24a into imacrayon:main Nov 4, 2024
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