Skip to content

Commit 9dd1f8a

Browse files
jkebingerclaude
andcommitted
Fix MSW test helper to clone request before reading body
Clone the request before calling .json() to prevent "Request already used" errors in MSW handlers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 08ba0af commit 9dd1f8a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

test/test-helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export const getCannedResponse = async (
105105
let body: DefaultBodyType = {}
106106

107107
if (request.method === 'POST') {
108-
body = await request.json()
108+
body = await request.clone().json()
109109

110110
if (!body || typeof body !== 'object') {
111111
throw new Error('Expected http body to be an object')

0 commit comments

Comments
 (0)