We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
writeToFile
"@pactflow/pact-msw-adapter": "3.0.0"
Please confirm the following:
The request body should be consumable in the MSW handler without causing writeToFile to fail.
writeToFile fails because it tries to clone the request and read the body which is already consumed (src).
This is not allowed by the specs (MDN):
clone() throws a TypeError if the request body has already been used.
clone()
TypeError
test('echo', async () => { server.use( http.post('*/echo', async ({ request }) => { const body = await request.json(); return HttpResponse.json(body); }) ); let response = await fetch('http://localhost/echo', { body: JSON.stringify({ test: 'data' }), method: 'POST', headers: { 'content-type': 'application/json' }, }); let body = await response.json(); expect(body).toEqual({ test: 'data' }); });
-
The text was updated successfully, but these errors were encountered:
Temporary workaround:
http.post('*/echo', async ({ request }) => { const body = await request.clone().json(); return HttpResponse.json(body); })
Sorry, something went wrong.
Happy to accept pull requests to sort, sorry for late reply
No branches or pull requests
Software versions
"@pactflow/pact-msw-adapter": "3.0.0"
Issue Checklist
Please confirm the following:
Expected behavior
The request body should be consumable in the MSW handler without causing
writeToFile
to fail.Actual behavior
writeToFile
fails because it tries to clone the request and read the body which is already consumed (src).This is not allowed by the specs (MDN):
Steps to reproduce
Relevant log files
-
The text was updated successfully, but these errors were encountered: