📺 Watch this recipe explained in the video Lesson 11: Check Multiple Links Quicklyopen in new window.

<ul id="links-to-check">
  <li><a href="https://glebbahmutov.com">my site</a></li>
  <li>
    <a href="https://glebbahmutov.com/soccer"
      >my site soccer page</a
    >
  </li>
  <li><a href="https://cypress.tips">cypress.tips</a></li>
  <!-- this url is broken on purpose -->
  <!-- <li><a href="https://cypress.TIPZ">cypress.TIPZ</a></li> -->
</ul>
cy.get('#links-to-check a')
  // cy.map comes from the cypress-map plugin
  .map('href')
  .each((url) => cy.request(url))

Note: we can "simplify" the callback by constructing an unary version of cy.request function command to avoid any cy.request confusion from multiple arguments passed by cy.eachopen in new window. For more on unary functions and a good example, read my blog post Functional JavaScript interview questionopen in new window

cy.log('**unary example**')
cy.get('#links-to-check a')
  // cy.map comes from the cypress-map plugin
  .map('href')
  .each(Cypress._.unary(cy.request))