function doFetch(url, method = `GET`) {
  return new Promise(resolve => {
    const req = new XMLHttpRequest()
    req.open(method, url, true)
    req.onreadystatechange = () => {
      if (req.readyState == 4) {
        resolve(req)
      }
    }
    req.send(null)
  })
}
Utility to check the path that goes into doFetch for e.g. potential malicious intentions.
It checks for "//" because with this you could do a fetch request to a different domain.