Testing methods that make http requests

前端 未结 7 1341
悲哀的现实
悲哀的现实 2021-02-09 01:31

I have some methods in my app that make http requests. Is there a good way to simulate network failures and bad responses for the unit tests?

7条回答
  •  攒了一身酷
    2021-02-09 02:19

    Pull out your lan wire, or turn off your wireless router while the requests are being made :)

提交回复
热议问题