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

Allow setting custom headers #78

Open
colearendt opened this issue Feb 26, 2019 · 0 comments
Open

Allow setting custom headers #78

colearendt opened this issue Feb 26, 2019 · 0 comments

Comments

@colearendt
Copy link

colearendt commented Feb 26, 2019

Related to #77 , it would be nice to be able to set arbitrary headers (i.e. not just userAgent). Unfortunately, per

It seems that pageSettings does not work for setting arbitrary headers (at least not with the incantations I tried), and passing the headers to .open() does not send the headers with follow-on requests. As a result, the preferred (and workable) approach was to add the following to webshot.js before casper.start():

casper.on('started', function () {
  this.page.customHeaders = {
    "Header" : "Value" 
  };
});

This is also anecdotally related to #49 , because I am using headers for authentication to RStudio Connect (in lieu of clicking through auth and then saving a cookie).

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

No branches or pull requests

1 participant