From 065766c65ca4513c74a55b9166d55864891e1727 Mon Sep 17 00:00:00 2001 From: Dominic Watson Date: Sun, 18 Jun 2017 00:20:42 +0200 Subject: [PATCH] Add Origin header for CORS support (#66) --- main.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.js b/main.js index 3bf27ab..2b21cb1 100644 --- a/main.js +++ b/main.js @@ -23,6 +23,11 @@ app.on('ready', function() { mainWindow = new BrowserWindow({ width: 1024, height: 728 }); + electron.session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => { + details.requestHeaders['Origin'] = 'electron://graphiql-app'; + callback({ cancel: false, requestHeaders: details.requestHeaders }); + }); + if (process.env.HOT) { mainWindow.loadURL('file://' + __dirname + '/app/hot-dev-app.html'); } else {