ArcBees / gwtquery

A jQuery clone for GWT, and much more.
MIT License
85 stars 38 forks source link

I am unable to set the contentType on an ajax request #383

Open chinshaw opened 7 years ago

chinshaw commented 7 years ago

I am trying to submit a form upload using the Ajax request but it appears that the contentType is being overridden with the resolveSettings() method of the Ajax class. In my example below when I observe the request to the server it is setting the content type to urlencoded instead of using my choice of multipart/form-data.

form.bind("submit", null, new Function() {
            public boolean f(Event e) {
                Ajax.ajax(Ajax.createSettings().setType("post").setContentType("multipart/form-data")
                        .setUrl(form.attr("url")).setData(form).setSuccess(new Function() {
                            public void f() {
                                Window.alert("SUCCESS");
                            }
                        }));
                e.preventDefault();
                return true;
            }
        });