Closed mujianping closed 5 years ago
放在 finally
中可以保证异常时也有响应。
放在try里的话,异常时应该走exceptionCaught方法了吧,要不出现异常会不会exceptionCaught和responseContent执行重复 @crossoverJie
放在try里的话,异常时应该走exceptionCaught方法了吧,要不出现异常会不会exceptionCaught和responseContent执行重复 @crossoverJie
应该是说反了,只有异常时 exceptionCaught
和 responseContent
都会执行,但其实问题也不大;
http
是短连接,在 exceptionCaught
做了响应后,responseContent
的响应对之前的响应并没有影响。
不过这里倒确实可以优化下,没必要响应两次。
对就这意思,不愧是大jie哥! @crossoverJie