title: Handling GET requests - Apache HttpClient vs java.net.HttpURLConnection
body: <p>Does the Apache HttpClient handle GET requests differently compared to java.net.HttpURLConnection? </p>
  
  <p>I tried making a GET request to a URL which returns a redirect using both methods. While the response code from HttpURLConnection returns a 302 as expected, making the same call using HttpClient results in a 200. </p>
  
  <p>Below is my code:</p>
  
  <pre><code>// Using Apache HttpClient
  HttpClient client = HttpClientBuilder.create().setRedirectStrategy(new LaxRedirectStrategy()).build();
  HttpGet request = new HttpGet(authUrl);
  HttpResponse response = client.execute(request);
  int responseCode = response.getStatusLine().getStatusCode();  //Returns 200
  
  // Using java.net.HttpURLConnection
  URL obj = new URL(authUrl);
  HttpURLConnection conn = (HttpURLConnection) obj.openConnection();
  int responseCode = conn.getResponseCode();  //Returns 302
  </code></pre>
  
  <p>This is my first time using Apache HttpClient, so my code might be wrong.</p>
  
  <p>Thanks.</p>