on 'resource.received' access the response, not just metadata

49 views
Skip to first unread message

Danni Allen

unread,
Apr 26, 2016, 3:11:48 AM4/26/16
to CasperJS
Hi,

Is it possible to do as per the subject?  The webpage I am working with sends a file in the response to myself and I can detect this, however the url it provides is to the base page.  So I cannot download the file by accessing the resource.url portion of the metadata.  Is there a simple way (or any way) of getting the raw response (or something)?  I can see it coming through Fiddler just fine.  Code is below.

casper.on('resource.received', function (resource) {
    var url, file;
    url = resource.url;
    file = "stats.csv";
    //this.echo(JSON.stringify(response));
    if (resource.contentType.indexOf("ms-excel") > -1){
        //this.download(url, file, "GET");
        this.echo(JSON.stringify(resource));
        //this.echo(this.page.content);
    }
});

Thanks,
Danni

ENRIQUE GARCIA

unread,
Jul 5, 2016, 3:37:23 AM7/5/16
to CasperJS, danni...@gmail.com
I have the same issue. I tried with a proxy (on mac) and it did not work. 

Reply all
Reply to author
Forward
0 new messages