- From: Jimmy Wärting <notifications@github.com>
- Date: Wed, 18 Apr 2018 10:28:53 +0000 (UTC)
- To: whatwg/xhr <xhr@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 18 April 2018 10:29:19 UTC
Like the URLSearchParams allow the FormData constructor able to accept a iterable array or object
instead of having to manually append everything
Current way of solving things:
```js
var data = ['foo', 'bar']
var data = {foo: 'bar'}
var fd = new FormData()
for (let [key, val] of new URLSearchParams(data)) {
fd.append(key, val)
}
// or one-liner
new URLSearchParams(data).forEach(args => fd.append(...args))
```
Suggested way
```js
var data = ['foo', 'bar']
var data = {foo: 'bar'}
var fd = new FormData(data)
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/xhr/issues/202
Received on Wednesday, 18 April 2018 10:29:19 UTC