October 1, 2020

17:37

Looks like I finally finished migrating from Apache HttpClient v4.x to v5.0. Two solid days of work, but probably worth it in the long run. I still don’t get the new design of the HttpClient interface. If you are using it without a Handler, you get a HttpResponse that you can’t close without an ugly cast, potentially either resulting in a resource leak or a class cast exception. The examples all say to use an instance of CloseableHttpClient instead (from which everything is subclassed), but what’s the point of having an interface if you have to use it’s one implementation anyways?