Commit ab761929 ab761929c79df32b940b840dae45a2d2aed7d43e by Rafael Garcia Committed by Nicolas Perriault

allowing downloads to be triggered by more than just GET requests

1 parent aab7d18d
...@@ -350,10 +350,10 @@ Casper.prototype.die = function die(message, status) { ...@@ -350,10 +350,10 @@ Casper.prototype.die = function die(message, status) {
350 * @param String targetPath The destination file path 350 * @param String targetPath The destination file path
351 * @return Casper 351 * @return Casper
352 */ 352 */
353 Casper.prototype.download = function download(url, targetPath) { 353 Casper.prototype.download = function download(url, targetPath, method, data) {
354 var cu = require('clientutils').create(); 354 var cu = require('clientutils').create();
355 try { 355 try {
356 fs.write(targetPath, cu.decode(this.base64encode(url)), 'w'); 356 fs.write(targetPath, cu.decode(this.base64encode(url, method, data)), 'w');
357 this.emit('downloaded.file', targetPath); 357 this.emit('downloaded.file', targetPath);
358 this.log(f("Downloaded and saved resource in %s", targetPath)); 358 this.log(f("Downloaded and saved resource in %s", targetPath));
359 } catch (e) { 359 } catch (e) {
......