Skip to content

Instantly share code, notes, and snippets.

@binux
Created October 25, 2019 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save binux/3c2023793e1bf1ff03a8fcb24b026162 to your computer and use it in GitHub Desktop.
Save binux/3c2023793e1bf1ff03a8fcb24b026162 to your computer and use it in GitHub Desktop.
const {app, BrowserWindow} = require('electron')
app.once('ready', async () => {
win = new BrowserWindow()
win.webContents.session.webRequest.onBeforeSendHeaders((details, callback) => callback({}));
win.webContents.once('did-finish-load', async () => {
const html = await win.webContents.executeJavaScript('document.documentElement.innerHTML');
console.log(html);
app.quit()
})
await win.webContents.loadURL('https://httpbin.org/headers', {"extraHeaders":"Addition-Header: hello world"})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment