cloudflare / node-cloudflare

Node.js API for Client API
https://cloudflare.github.io/node-cloudflare/
Other
335 stars 92 forks source link

Added support for form-data object as an option #43

Closed danielsmithsd closed 7 months ago

danielsmithsd commented 6 years ago

With the new support of WebAssembly on Workers, the new API requires the request be sent with extensive form data. Instead of abstracting the API away from the user, I opted to enable support for passing a form-data object (also supported by got). This enables WASM support without much work on the SDK.

See WASM API docs here: https://developers.cloudflare.com/workers/api/resource-bindings/webassembly-modules/

danielsmithsd commented 6 years ago

Could go either way on the last two commits. One is more explicit than the other but leaves the opportunity to supply both form-data and raw data which could be confusing. This is a pretty simple implementation that works for my use case.

nicodoggie commented 5 years ago

Any chance we can bump this? This would also help with binding Worker KV to scripts for free, I think.

terinjokes commented 5 years ago

Reading the current version of the Workers API documentation, and it's not clear to me it still accepts form data. I might have to dig into wranger to see what it does.