Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

FormData doesn't exist #153

Open
maple3142 opened this issue Aug 20, 2020 · 0 comments
Open

FormData doesn't exist #153

maple3142 opened this issue Aug 20, 2020 · 0 comments

Comments

@maple3142
Copy link

maple3142 commented Aug 20, 2020

addEventListener('fetch', event => {
  event.respondWith(handleRequest(event.request))
})

/**
 * Respond to the request
 * @param {Request} request
 */
async function handleRequest(request) {
  const fd = new FormData()
  return new Response('hello world', {status: 200})
}

This script runs in CloudFlare workers normally, but not in CloudWorker.

But it can be solved by using bindings:

{
	bindings: {
		FormData: require('form-data')
	}
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant