Commit 48f10b55 48f10b55b5cc140c90e5ffcf9f2f34ed10e2cc09 by Nicolas Perriault

fixed #819 - don't override mime for std contents in sendAJAX

1 parent eb78ac3b
...@@ -376,7 +376,9 @@ ...@@ -376,7 +376,9 @@
376 */ 376 */
377 this.getBinary = function getBinary(url, method, data) { 377 this.getBinary = function getBinary(url, method, data) {
378 try { 378 try {
379 return this.sendAJAX(url, method, data, false); 379 return this.sendAJAX(url, method, data, false, {
380 overrideMimeType: "text/plain; charset=x-user-defined"
381 });
380 } catch (e) { 382 } catch (e) {
381 if (e.name === "NETWORK_ERR" && e.code === 101) { 383 if (e.name === "NETWORK_ERR" && e.code === 101) {
382 this.log("getBinary(): Unfortunately, casperjs cannot make cross domain ajax requests", "warning"); 384 this.log("getBinary(): Unfortunately, casperjs cannot make cross domain ajax requests", "warning");
...@@ -758,7 +760,9 @@ ...@@ -758,7 +760,9 @@
758 var contentType = settings && settings.contentType || "application/x-www-form-urlencoded"; 760 var contentType = settings && settings.contentType || "application/x-www-form-urlencoded";
759 xhr.open(method, url, !!async); 761 xhr.open(method, url, !!async);
760 this.log("sendAJAX(): Using HTTP method: '" + method + "'", "debug"); 762 this.log("sendAJAX(): Using HTTP method: '" + method + "'", "debug");
761 xhr.overrideMimeType("text/plain; charset=x-user-defined"); 763 if (settings && settings.overrideMimeType) {
764 xhr.overrideMimeType(settings.overrideMimeType);
765 }
762 if (method === "POST") { 766 if (method === "POST") {
763 if (typeof data === "object") { 767 if (typeof data === "object") {
764 for (var k in data) { 768 for (var k in data) {
......