Skip to content

Conversation

@leo91000
Copy link

Fixes #74

When hookOptions: { cloneResponse: true } is set, error responses now work correctly.

Root cause: response.text() was called before response.clone(), consuming the body.

Fix: Clone before consuming in the error branch.

When cloneResponse option is enabled, clone the response before calling

response.text() so the original response can still be cloned for hooks.

Fixes better-auth#74
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.

cloneResponse: true breaks onError hook - "Body has already been consumed"

1 participant