How can I intercept some HTTP request fallback to custom file?


I use win.loadURL(‘’) to load a page, and I want to intercept this request fallback to custom file like:

protocol.interceptStringProtocol(‘http’, (request, callback) => {

data: fs.readFileSync(path.normalize(${__dirname}/index.html), ‘utf-8’)
this will intercept all HTTP requests from this page. How can I do only intercept some HTTP requests?