Fix infinite loop in HttpClient