Some improvements to the http client API