Home > Software engineering >  How to know if an API returns a response with status code 200
How to know if an API returns a response with status code 200

Time:11-05

Basically I am starting with Jest and I want to know with this tool if an API returns a response with status code 200. I have searched many ways to do it on the internet but none of them worked for me and I kept getting errors.

Could someone give me a hand on that?

For example, make a Rick & Morty API call with either Axios or Fetch and see if it returns a 200 status code:

Result

CodePudding user response:

Originally answered Second result (part 1)

Second result (part 2)



UPDATE:

Third result

  • Related