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

TypeError: request.clone(...).formData is not a function #892

Closed
rolandjohann opened this issue May 3, 2023 · 1 comment · Fixed by #893
Closed

TypeError: request.clone(...).formData is not a function #892

rolandjohann opened this issue May 3, 2023 · 1 comment · Fixed by #893
Labels
bug Something isn't working

Comments

@rolandjohann
Copy link
Contributor

Describe the bug
The method formData() is missing at Request interface and its implementation.

https://developer.mozilla.org/en-US/docs/Web/API/Request/formData

To Reproduce

it('should work with form data', async () => {
  const formData = new FormData();
  formData.append('some', 'test');
  const request = new Request('http://foo.bar/baz', { method: 'post', body: formData });
  const formDataFromRequest = await request.formData();
  expect(formDataFromRequest).toBe(formDataFromRequest);
});

Actual Behavior

TypeError: request.formData is not a function

Expected behavior
test should succeed

Additional context
We start to migrate a project to remix and to implement the action/loader unit tests where we need to construct Requests manually and pass them the form data.

@rolandjohann rolandjohann added the bug Something isn't working label May 3, 2023
rolandjohann added a commit to one-focus-io/happy-dom that referenced this issue May 3, 2023
capricorn86 added a commit that referenced this issue May 4, 2023
@capricorn86
Copy link
Owner

@rolandjohann your fix has been released 🙂

You can read more about the release here:
https://github.com/capricorn86/happy-dom/releases/tag/v9.10.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants