title: In Cypress, After an UI operation how to check a particular API call is triggered in Network tab and verify the Status as 200
body: <p>I have a web application to perform the update operation with the help of a <strong>Update button</strong> in UI mode.</p>
  <p>During that time list of APIs are loaded into the Network tab with XHR type as below. I have to verify one of the API put call is triggered and the status is passed.</p>
  <p><a href="https://i.stack.imgur.com/w1om5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/w1om5.png" alt="enter image description here" /></a></p>
  <blockquote>
  <p>url.toString() --  <a href="https://abcdef.execute-api.ue-east-2.amazonaws.com/stg2" rel="nofollow noreferrer">https://abcdef.execute-api.ue-east-2.amazonaws.com/stg2</a></p>
  </blockquote>
  <p><em>It contains the RequestedURL value. I manually verified that in Network tab for that particular API put call. Then kept that in cypress.json and reading the url to the current class</em></p>
  <blockquote>
  <p>Base URL for the UI operation: <a href="https://abc-stg2.awsdev.fgh.com/" rel="nofollow noreferrer">https://abc-stg2.awsdev.fgh.com/</a></p>
  </blockquote>
  <p><em>Note: The both url are modified and dummy one, since it is confidential to share. The understanding is API calls are in AWS and the UI urls are in other environment</em></p>
  <p><strong>Try #1</strong></p>
  <pre><code>// After the UI operation
  cy.intercept('PUT',url.toString()).as('urupdate')
    
  cy.wait('@urupdate',{requestTimeout:20000})
    .its('status')
    .should('be.eq',200)
  </code></pre>
  <p>Output:</p>
  <p><a href="https://i.stack.imgur.com/mPkfy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mPkfy.png" alt="enter image description here" /></a></p>
  <p><strong>Try #2</strong></p>
  <pre><code>cy.intercept('PUT', url.toString(), (req) =&gt; {
     if (req.body.status == 200) {
         cy.log('pass')
      }
  })
  </code></pre>
  <p>Output:</p>
  <p>The log is not getting printed and till the if statement everything is getting passed</p>
  <p>How can we verify the particular API is triggered and the status is 200?</p>
  <p>I have gone through the <em>intercept</em> as above and other stuffs in Cypress. But that does not get me the solution. Share your suggestions</p>