Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding processData option to Request. if set to false, passes the data... #2546

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

orthecreedence
Copy link

... key in the given options, verbatim, to the underlying XHR object. this allows passing of Blob, Uint8Array, etc objects. note that this required a change in Request.initialize that works around setOptions converting the binary data object into an empty Object {}.

Addresses issue #2181

…ta` key in the given options, verbatim, to the underlying XHR object. this allows passing of Blob, Uint8Array, etc objects. note that this required a change in Request.initialize that works around setOptions converting the binary data object into an empty Object {}.
@ibolmo ibolmo added this to the 1.6 milestone Mar 3, 2014
@ibolmo
Copy link
Member

ibolmo commented Mar 3, 2014

Haven't validated if this will be useful, but perhaps if you add examples to the docs, and specs to test for the new option it'll be clearer.

@WernerWenz
Copy link

I'm also in need of this sort of functionality.

Key point is, that it's currently required to replicate the whole Request logic as seen here:
https://github.com/arian/mootools-form-upload/blob/master/Source/Request.File.js

A solution to this Problem could either be adding a flag as it was suggested,
or having an automagic variant, that checks the data option for "instanceof FormData".

Having such a functionality would ultimalty allow us writing such code:

<form id="myform" action="new/data"><fields for form data here></form>
var form=$('myform');
(new Request.HTML({url: form.getProperty('action'), urlEncoded: false}).send(new FormData(form));

@SergioCrisostomo
Copy link
Member

Could one of you (@ghost, @WernerWenz or @orthecreedence ) add some working example for this? if possible a jsFiddle with specs example?

P.s: Andrew your comment on reddit made find about this PR :)

@WernerWenz
Copy link

Sure no Problem:

This is based on @orthecreedence's pull request:
http://jsfiddle.net/LYyLC/3/

Removing the new introduced processData will fail the test.
So will removing urlEncoded.

For convenience of use, I further suggest automagically inferring things as the action url and the method for example from the FormData, in case a FormData is supplied.

You might want to open a new ticket for this Sergio?

Edit: The console.log line was obviously not intended in the fiddle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants