title: Cypress XHR stubbing ignores ajax requests performed with fetch
body: <h1>Important Information</h1>
  
  <p>The original question here was not directly about the lack of support for <a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API" rel="noreferrer">the fetch api</a> in Cypress, but that was the cause for the problem I initially posted here. I've edited the title of the question and added this preamble here. Below this paragraph is the original content of the question:</p>
  
  <h1>Original question</h1>
  
  <p>The Cypress documentation is filled with examples where you can set an alias to a particular web request, and then you can instruct cypress to wait on it. Like for instance, <a href="https://github.com/cypress-io/cypress-example-recipes/blob/4d1340bb14e0f555ba197a334b8a925b83cc600d/examples/logging-in__xhr-web-forms/cypress/integration/logging-in-xhr-web-form-spec.js#L26-L34" rel="noreferrer">this one</a>:</p>
  
  <pre><code>cy.route('POST', '/login').as('postLogin')
  
  cy.get('input[name=username]').type('jane.lae')
  cy.get('input[name=password]').type('password123{enter}')
  
  // we should always explicitly wait for
  // the response for this POST to come back
  // so our tests are not potentially flaky or brittle
  cy.wait('@postLogin')
  </code></pre>
  
  <p>The thing is I'm trying to use this exact technique in my app's tests, but I need to wait on a request that is not made against the same server where the app is hosted. Therefore I am assuming that I can type in the full URL of the backend endpoint, so that <code>cy.route</code> does not prepend the <code>baseUrl</code>, which is the host of where the frontend app is hosted.</p>
  
  <pre><code>// The following URL points to a backend rails app
  // The frontend app I'm testing with cypress is at http://localhost:8080
  cy.route('POST', 'http:/localhost:3000/session').as('postLogin')
  // ... fill login form
  cy.wait('@postLogin')
  // The test never reaches this point
  </code></pre>
  
  <p>However, when I run my test, I get a timeout because cypress never realizes the request was performed, it continues to wait on it until it timeouts. Turns out when I inspect the test script on the left sidebar in the browser where cypress is running, the route has the explicit host I set, not only the path, but still the test stayed waiting for this request to occur, and it says it never occurs. When I inspect the network tab of the browser dev tools I can see the request occurred. And I can see in the terminal where my backend app is running, that it was indeed hit with a login request. Furthermore, I can see in my frontend app running in cypress' browser session, that the user signed in successfully and the app was redirected to the intended page after request.</p>
  
  <p>The question is: can I make cypress aware of cross-origin requests so that it can wait for them? If so, how?</p>
  
  <h1>Update:</h1>
  
  <p>Stubbed routes are also not caught by cypress, and I cannot wait on them, or prevent them from occurring, as it is expected for stubbed requests.</p>