joelgriffith / navalia

A bullet-proof, fast, and reliable headless browser API
https://joelgriffith.github.io/navalia/
GNU General Public License v3.0
957 stars 33 forks source link

goto with custom header #33

Closed Wykks closed 7 years ago

Wykks commented 7 years ago

Hi ! Thanks for this tool :+1: Just requesting a feature: add a way to pass custom headers to goto. Not sure how it works, but there's something about headers in Network.Request

joelgriffith commented 7 years ago

Great idea! I'm thinking something like:

chrome.goto('http://www.google.com', { headers: { Authorization: 'abcdefg' } })

OR, the other option:

chrome.header('Authorization', 'abcdefg');
chrome.goto()

I'm working on adding the latter no matter what, the first can be just sugar over what the .header API will look do?

joelgriffith commented 7 years ago

I don't have a parameter yet in goto, however there's a new API for this here: https://joelgriffith.github.io/navalia/Chrome/header/. You can call it before goto:

await chrome.header({ Authorization: 'abc:123' });
await chrome.goto('https://www.amazon.com');
Wykks commented 7 years ago

Oh cool thanks !