You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request #21 from excid3/cache-response-body
This saves the `text` and `json` values after reading. Fetch responses don't allow you to read these twice, so it's best if we memoize the results to prevent users from running into this.
```javascript
const request = new FetchRequest("post", url)
const response = await request.perform()
await response.text
await response.text
// => Failed to execute 'text' on 'Response': body stream already read
```
Most importantly, we need memoization so you can still read the response text after the Turbo Stream messages are read and rendered.
```
const request = new FetchRequest("post", url, { responseKind: "turbo-stream" })
const response = await request.perform()
await response.text
// => Failed to execute 'text' on 'Response': body stream already read
```
Fixes#19
0 commit comments