Home > database >  How to emulate HTTP error in React Native?
How to emulate HTTP error in React Native?

Time:03-28

I know some soft for view network requests in React Native, like reactotron (https://github.com/infinitered/reactotron) and react-native-debugger (https://github.com/jhen0409/react-native-debugger!), can help you to explore your HTTP traffic. But how about error emulation. For example if I want to check failed answer from the server, to get errors like:

500 Internal Server Error
501 Not Implemented 
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout

How can I emulate it with out help of back-end? I need some kind of sniffer. Can you share please your experience or recommend some sniffer utility for React Native?

CodePudding user response:

you can give this a try, you can pass the status you want to it and it will return it as an error https://httpstat.us/

CodePudding user response:

I have found a few proxy that very helpful with API debugging:

  1. Fiddler https://www.telerik.com/fiddler
  2. Charles https://www.charlesproxy.com/
  • Related