Skip to content

Should no longer recommend form-data #179

@jimmywarting

Description

@jimmywarting

I just so happen to find this project when i read a reddit post

// w is a reusable wretch instance
const w = wretch().polyfills({
  fetch: require("node-fetch"),
  FormData: require("form-data"),
  URLSearchParams: require("url").URLSearchParams,
});

i saw this snipped and node-fetch@3 no longer supports cjs and it have ditched support for the abnormal form-data package for not follow the standard and not being iterable and working with Blobs instead.
instead you should recommend a spec'ed variant of formdata such as formdata-polyfill which node-fetch now also depends internally on and re-exports it... just b/c it needs handle decoding payloads back to formdata using response.formData().then(fd => { ... })
so it should actually be:

import fetch, { FormData } from 'node-fetch'
const w = wretch().polyfills({ fetch, FormData })

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions