How can we use protocol.interceptFileProtocol with only certain paths, leaving other requests untouched?

#1

I’d like to intercept certain HTTP requests and manually load files from the file system as the responses.

So I thought I could use protocol.interceptFileProtocol like so:

protocol.interceptFileProtocol('http', (request, callback) => {
  // intercept only requests to "http://example.com"
  if (request.url.startsWith("http://example.com")) {
    callback("/path/to/file")
  }

  // otherwise, let the HTTP request behave like normal.
  // But how?
})

But how do we allow other http requests other than http://example.com to continue working like before?

EDIT: This looks like a duplicate of an unanswered question from 2017: How can I intercept some HTTP request fallback to custom file?