- From: David Graham <notifications@github.com>
- Date: Thu, 07 May 2015 09:57:45 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
Received on Thursday, 7 May 2015 16:58:12 UTC
When I was writing the JS polyfill from the Fetch spec, I interpreted passing an object as `body` to mean it would be used as a form encoded post request body. That was fixed and removed in https://github.com/github/fetch/pull/30. This assumption was probably based on experience with jQuery's `$.ajax` behavior. Intuitively, it seems like passing an object should do *something*. Whether it's turned into JSON automatically, wrapped in FormData automatically, or some other behavior is debatable. This issue would also be helped by enhancing the `FormData` constructor to accept an object like: ```js fetch('/query', { method: 'post', body: new FormData({ name: 'Hubot', login: 'hubot' }) }) ``` That would add symmetry with `JSON.stringify`: ```js fetch('/query', { method: 'post', body: JSON.stringify({ name: 'Hubot', login: 'hubot' }) }) ``` --- Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/issues/47#issuecomment-99937918
Received on Thursday, 7 May 2015 16:58:12 UTC