Is my implementaton of HttpClient singleton appropriate? [closed]

别来无恙 提交于 2019-12-04 02:50:30

There are a few properties that you cannot change after you have made the first request. I think timeout might be one of them, so be aware of that.

You also need to be careful that individual requests don't mess with the DefaultRequestHeaders as that could confuse other requests.

It is always a good idea to try and share HttpClient instances. Creating a singleton is an extreme case of that but with care it should work just fine for you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!