const { session } = require('electron')
// 给所有请求增加一个header
  session.defaultSession.webRequest.onBeforeSendHeaders({ urls: ['*'] }, (details, callback) => {
    details.requestHeaders['Version'] = '20190620'
    callback({ cancel: false, requestHeaders: details.requestHeaders })
  })
来源:中战博客,欢迎分享!
标签: electron,onBeforeSendHeaders,header